# Distance to stop given initial velocity, initial acceleration, and maximum jerk

Given an initial velocity $$v_0$$, initial acceleration $$a_0$$, and a maximum (positive or negative) jerk $$j$$, what will be the final resting position $$p$$ (in relation to the initial position) when coming to a complete stop (velocity and acceleration both 0) in the shortest amount of time?

Velocity and acceleration are both unbounded.

For simplicity please assume velocity is a positive value.

I believe I've partially solved the problem.

Given the situation where acceleration is zero the shortest stopping time should be achieved with negative jerk $$j$$ for $$t$$ time (at which point velocity should equal $$\frac{v_0}2$$) and then positive $$j$$ for $$t$$. At this point velocity and acceleration will both be zero.

$$t$$ can be determined with: $$\frac{v_0}2 = v_0 - \frac{1}2jt^2$$

$$t = \frac{\sqrt{v_0}}{\sqrt{j}}$$

Distance traveled during this "first" jerk is then: $$d_0 = v_0 t - \frac{j t^3}6$$

$$d_0 = \frac{5 v_0^{\frac{3}2}}{6\sqrt{j}}$$

Acceleration after this "first" jerk: $$a_1 = -j t$$

Distance traveled during the "second" jerk should be: $$d_1 = \frac{1}2v_0 t + \frac{1}2 a_1 t^2 + \frac{1}6 j t^3$$

$$d_1 = \frac{v_0^\frac{3}2}{6\sqrt{j}}$$

Stopping distance in relation to initial position is then of course: $$p = d_0 + d_1$$

That's just when initial acceleration $$a_0$$ is zero.

If $$a_0$$ is positive (accelerating) the problem is almost as easy. Just apply negative jerk $$j$$ until acceleration is zero, get the distance traveled and new velocity (easy), solve per above now that acceleration is zero, and add all the distances together.

But I am not sure how to solve the problem when $$a_0$$ is negative. (starting in a state of deceleration.)

Your solution for positive $$a_0$$ is a strong hint about what to do for negative $$a_0.$$
Starting with negative $$a_0,$$ assume maximally negative jerk and solve for the time in the past when acceleration would have been zero. Solve also for the position and velocity at that time. Then proceed as before.