Skip to main content
2 of 2
Answer to comment.

Let $a$ be the acceleration, $v_i$ the initial velocity, $v_f$ the final velocity, $v(t)$ the velocity at time $t$, $d$ the distance, $T_s$ the switch time and $T_f$ the final (stopping) time. Then it is easily seen that

$$d=-\frac{a}{2}(T_f^2 - 4T_fT_s + 2Ts^2)+ T_f v_i,\quad v(T_f)=v_i+2aT_s-aT_f=v_f.$$

This is a system of two equations and two unknowns, whose solution is

$$ T_s=\frac{2v_i+\sqrt{4ad+2(v_i^2+v_f^2)}}{2a},\quad T_f=\frac{v_i+v_f+\sqrt{4ad+2(v_i^2+v_f^2)}}{a}. $$

This is an edit in answer to your comments. Define $acc(t)=a$ if $0\le t\le T_s$, $acc(t)=-a$ if $t>T_s$ (I am implicitely assuming that $T_f>T_s$. Then $$v(t)=\int_0^t acc(s)ds=v_i+aT_s-a(t-T_s)\hbox{ for } t>T_s.$$ Thus, $v_f=v(T_f)=v_i+2aT_s-aT_f$. Similarly, $$d=\int_0^{T_f}v(t)dt.$$ My solution agrees with yours when $v_i=v_f$. And by the way, I used Mathematica for the computations.