Okay.

The "net" distance would be x(5)- x(0). but "total" distance might be different- the object might have gone past x(5) then back.

What I would do is this: differentiate the x(t) function to fine the "velocity" function and determine where that is equal to 0. Points where the derivative is 0 show where x itself is a local max or min- in other words where you might have turned around and back tracked.

Once you have found, say,

,

, [tex]t_2[tex], etc. as points where the derivative is 0, Start at t= 0 and determine the first "turn around" time. If it is less than t=5, calculate the distance from x(0) to that "turn around" point. Find the next "turn around time" if there is one. If it is less than 5, calculate the distance between those two "turn around points"- the difference is x values may be negative but remember that distance is always positive- take the absolute value.