i see what you mean.......

x(t)=x(0)+v(0)*t+0.5*t*t;
v(t)=v(0)+a*t;

is good and already implemented it this way.

codes:
x1 = x1s - x10;


but the distance traveled is another concept in secondary school as the Math.abs (integral of the area under the v-t graph) as distance traveled.

i am having difficulty implementing it elegantly (because there is positive area and Math.abs|negative| area).
;D


Thanks!

so far, i think the best approach for me is by brute force aka not so elegant way Smiley( if statements )
codes:
if(v10>=0 && v1s>=0){
d1 = Math.abs(0.5*(v10+v1s)*(ts-0));
}
if(v10<=0 && v1s<=0){
d1 = Math.abs(0.5*(v10+v1s)*(ts-0));
}
if(v10>=0 && v1s<0){
tprime= v10*ts/(v10-v1s);
dtest = Math.abs(0.5*(ts-tprime)*v1s);
d1 = Math.abs(0.5*(v10)*tprime) + Math.abs(0.5*(ts-tprime)*v1s);
}
if(v10<=0 && v1s>0){
tprime= v10*ts/(v10-v1s);
dtest = Math.abs(0.5*(ts-tprime)*v1s);
d1 = Math.abs(0.5*(v10)*tprime) + Math.abs(0.5*(ts-tprime)*v1s);
}
[color=red][b]
I have do it!!![/b][/color]