How much time does a low-effort transfer need?
A cart must move a specified distance and stop. Reducing the squared acceleration tends to favor a smooth control signal, but the smooth optimum may ask for more acceleration than the actuator can deliver. A feasible alternative may still exist. This experiment separates those questions.
This is an original teaching construction for the ideal double integrator. It is not a reproduction of a Stanford assignment or a claim that any real vehicle is safe. The derivations below establish the formulas; the browser evaluates them locally.
Solid teal: minimum squared-acceleration effort without an actuator bound. Dashed gold: two equal-duration, opposite acceleration pulses. Dotted horizontal lines in the acceleration plot: actuator bounds. Each plot has its own vertical scale and units.
| Quantity | Value |
|---|---|
| Minimum-effort analytical integral (m²/s³) | |
| 401-point trapezoidal check (m²/s³) | |
| Two-pulse effort (m²/s³) | |
| Minimum-effort peak acceleration (m/s²) | |
| Least feasible duration with the bound (s) | |
| Duration needed for the unconstrained optimum to satisfy the bound (s) |
Define the plant and the quantity being minimized
Let \(t\in[0,T]\) denote time in seconds, with fixed duration \(T\gt0\). Let \(p(t)\) be position in meters, \(v(t)\) velocity in meters per second, and \(u(t)\) controlled acceleration in meters per second squared. The ideal dynamics are \(\dot p=v\) and \(\dot v=u\). The prescribed displacement is \(D\in\mathbb R\). The endpoint conditions are \(p(0)=v(0)=v(T)=0\) and \(p(T)=D\).
The effort functional is \(J[u]=\int_0^T u(t)^2\,dt\). Its units are m²/s³. This is a squared-acceleration criterion, not physical energy measured in joules. Friction, actuator dynamics, measurement error, obstacles, and jerk constraints are absent. Controls are square-integrable functions; bounded pulse controls are allowed even though they have a jump.
A globally optimal affine acceleration
Integrating the velocity equation gives \(\int_0^T u(t)\,dt=0\). Integrating once more, or exchanging the order in the iterated integral, gives \(D=\int_0^T(T-t)u(t)\,dt\). The two endpoint requirements are therefore linear conditions on the control history.
Consider an affine candidate \(u_\star(t)=a+bt\), where \(a\) has acceleration units and \(b\) has acceleration-per-second units. The two conditions become \(aT+bT^2/2=0\) and \(aT^2/2+bT^3/6=D\). Eliminating \(a\) gives \(b=-12D/T^3\), then \(a=6D/T^2\). Define normalized time \(\tau=t/T\). Integrating this acceleration yields
\[ u_\star(t)=\frac{6D}{T^2}(1-2\tau),\qquad v_\star(t)=\frac{6D}{T}\tau(1-\tau),\qquad p_\star(t)=D(3\tau^2-2\tau^3). \]These formulas satisfy all four endpoint conditions, but feasibility alone does not prove optimality. For that, take any other feasible control \(u=u_\star+w\), where the perturbation \(w\) is square-integrable. Feasibility of both controls implies \(\int_0^T w\,dt=0\) and \(\int_0^T(T-t)w\,dt=0\), hence also \(\int_0^T tw\,dt=0\). Since \(u_\star\) is affine, its inner product with \(w\) vanishes. Expanding the square now gives
\[ J[u]=J[u_\star]+2\int_0^T u_\star w\,dt+\int_0^T w^2\,dt =J[u_\star]+\int_0^T w^2\,dt\ge J[u_\star]. \]Thus the candidate is a global minimum, unique up to changes on sets of time of measure zero. The proof uses the linear dynamics, fixed endpoints, and quadratic effort; it does not automatically extend to nonlinear plants or obstacle avoidance. This is a concrete sufficient argument beyond the necessary stationarity conditions introduced in the official calculus-of-variations slides.
Substitution into the integral gives \(J[u_\star]=12D^2/T^3\). Doubling the distance multiplies effort by four. Doubling the allowed duration divides effort by eight. Figure 1 makes the corresponding decrease in acceleration visible. The numerical column integrates the sampled acceleration using the trapezoidal rule; it deliberately exposes a small quadrature error instead of returning the same closed formula twice.
Two different time thresholds
Let \(A\gt0\) be a symmetric acceleration bound, so \(|u(t)|\le A\). The affine optimum has peak magnitude \(6|D|/T^2\); it respects the actuator bound exactly when \(T\ge\sqrt{6|D|/A}\). This tests the feasibility of one candidate. It does not yet determine whether some bounded control can complete the transfer.
For positive displacement, any bounded rest-to-rest motion satisfies \(v(t)\le At\) by the initial velocity and \(v(t)\le A(T-t)\) by the final velocity. Therefore \(D=\int_0^T v(t)\,dt\le AT^2/4\). Negative displacements obey the same bound after reversing signs. Equality is achieved by acceleration \(+A\) until \(T/2\), then \(-A\). Smaller displacements are achieved by scaling that pair to \(+4D/T^2\) and \(-4D/T^2\). Feasibility is therefore equivalent to
\[T\ge 2\sqrt{|D|/A}.\]Between the two thresholds, a bounded solution exists even though the unconstrained minimum-effort solution violates the actuator limit. The gold curve displays a feasible two-pulse construction in that region; this page does not solve for the constrained minimum-effort control there. Below the first threshold both displayed transfer curves violate the available control authority. The feasibility statement permits instantaneous switching and no speed bound, so it cannot certify a physical actuator with finite bandwidth.
Reproduce and challenge the calculation
The Python lab implements minimum_energy_transfer and two_pulse_transfer. Inputs have the domains and units just defined. The functions return numerical arrays or scalars, perform no hardware control or network requests, and reject nonfinite or invalid duration inputs. The runnable checks compare analytic effort with independent numerical quadrature and test zero displacement, negative displacement, and an infeasible hard endpoint request.
import numpy as np
from numerical_lab import minimum_energy_transfer, two_pulse_transfer
time = np.linspace(0, 2, 10001)
position, velocity, acceleration = minimum_energy_transfer(1, 2, time)
assert np.allclose([position[0], velocity[0], position[-1], velocity[-1]],
[0, 0, 1, 0])
assert abs(np.trapezoid(acceleration ** 2, time) - 1.5) < 1e-7
assert np.allclose(two_pulse_transfer(1, 2, limit=1), [1, 1, 2])
Set \(D=1\) m and \(A=1\) m/s². A transfer in two seconds is just feasible, but its minimum-effort unconstrained candidate demands 1.5 m/s². Increasing duration to 2.5 seconds reduces that peak to 0.96 m/s² and the effort to 0.768 m²/s³. Both changes follow from the different powers of \(T\), not from a fitted controller.
Worked exercise: does a two-second infeasible smooth optimum imply failure?
No. The bounded minimum-time threshold is \(2\sqrt{1/1}=2\) seconds, whereas the smooth optimum becomes feasible only at \(\sqrt6\approx2.44949\) seconds. At two seconds the pulses \(+1,-1\) m/s² achieve the transfer. Their effort is \(1^2\cdot1+(-1)^2\cdot1=2\) m²/s³. The smaller unconstrained optimum, 1.5 m²/s³, is a lower bound on feasible bounded effort but is unattainable under this acceleration limit at this duration.
Worked exercise: why does waiting forever require a time penalty?
For nonzero \(D\), the effort \(12D^2/T^3\) is positive for every finite duration and converges to zero as \(T\to\infty\). If duration is free and effort is the only objective, the infimum is zero and no finite transfer attains it. A deadline or a positive time cost repairs this particular pathology. The issue is existence of a minimizer, not a failure of a numerical optimizer.
The official indirect-methods slides use a related double-integrator example with a free-time penalty. The derivation and interactive comparisons here use independently chosen distances, times, and constraints.