Fundamentals / Numerical mathematics / Numerical ordinary differential equations

Differentiate a bouncing trajectory through an impact

A camera records height at a fixed time after an object hits the floor. A nearby release height changes the impact time as well as the rebound speed. Compute the sensitivity that an estimator needs, and see why differentiating just the reset of velocity gives an incorrect answer even with an accurately located impact.

Distinguish a fixed observation time from an event time

A point mass falls from rest at height \(h\) under acceleration \(-g\). Let the rigid floor reset its incoming velocity \(v^-\) to \(v^+=-e v^-\), where \(0<e<1\). Derive its first impact time and the derivative of that time with respect to \(h\). Which derivative of height vanishes at the impact?

Work through the solution

Before contact \(y=h-gt^2/2\), \(v=-gt\). Setting \(y=0\) gives

\[\tau=\sqrt{2h/g},\]
\[d\tau/dh=1/(g\tau).\]

The height evaluated at its own impact is \(y(\tau(h),h)=0\) for every release, so its total derivative is zero. At a fixed time before impact the partial derivative \(\partial y/\partial h\) is instead one. The chain rule relates them: \(1+v^-d\tau/dh=0\), since \(v^-=-g\tau\). A camera clock held fixed during the experiment asks for a fixed-time sensitivity. A switch that records exactly at contact uses the event-time derivative. They describe different observations of the same trajectory.

Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.

Derive the missing timing term in the tangent update

Write \(X=(y,v)\), \(F=(v,-g)\), \(n=(1,0)^T\) and the reset \(R(y,v)=(y,-ev)\) on the guard \(y=0\). For a state perturbation \(z^-\) compared at the nominal event time, follow it to its own event and then synchronise it with the nominal post-impact time. What matrix maps it to \(z^+\)?

Work through the solution

The perturbed impact is shifted by \(\delta\tau=-n^Tz^-/(n^TF^-)\). At its own event the perturbation of the incoming state is \(z^-+F^-\delta\tau\). Applying the reset derivative gives \(DR(z^-+F^-\delta\tau)\). To compare states at a common time, advance the reset state back by \(\delta\tau\) using the outgoing field, subtracting \(F^+\delta\tau\). Thus \(z^+=[DR+(F^+-DRF^-)n^T/(n^TF^-)]z^-\). The bracket is the saltation matrix. It includes the change in impact time and depends on both vector fields. A transversal crossing, \(n^TF^-\ne0\), is required for this calculation.

Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.

With \(DR={\rm diag}(1,-e)\) and \(F^+=(-ev^-,-g)\), the matrix has first row \((-e,0)\) and second row \((-(1+e)g/v^-,-e)\). The height perturbation's sign immediately after the event can seem surprising. A higher release reaches the floor later; at the nominal impact the newly rebounding higher-release trajectory has had less time to rise. The saltation matrix compares neighbouring smooth branches extended to a common time. Exactly at the discontinuity of the velocity field the full fixed-time map can be nonsmooth; the one-sided propagated tangent on either side is what the matrix supplies.

Compare the tangent to the exact rebound trajectory

Set \(h=1.00\,{\rm m}\), \(g=9.81\,{\rm m/s^2}\), \(e=0.80\), and observe at \(T=0.600\,{\rm s}\). Compute the height and velocity sensitivity with respect to initial height in SI units. What would a reset-only implementation predict?

Work through the solution

The impact occurs at \(0.45152\,{\rm s}\), leaving \(\Delta=T-\tau=0.14848\,{\rm s}\) of rebound. The pre-impact tangent is \((1,0)\), so just afterwards it becomes \((-e,(1+e)/\tau)\). Free transport to \(T\) gives

\[\partial_h y=-e+(1+e)\Delta/\tau\approx-0.208,\]
\[\partial_h v=(1+e)/\tau\approx3.99\,{\rm s^{-1}}.\]

The units of the first derivative are metres per metre. A naive reset-only operation leaves \((1,0)\) unchanged and gives both the wrong sign of the position response and zero velocity response.

Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.

One can check the calculation without any tangent integration. The first-rebound solution is

\[y=e g\tau(T-\tau)-g(T-\tau)^2/2,\]
\[v=e g\tau-g(T-\tau).\]

Differentiate these expressions at fixed \(T\), remembering \(\tau\) depends on \(h\), to obtain the same two results. At a known \(T\) shortly after rebound, a measured height alone may decrease when the release height increases. After sufficient time on the same rebound branch this derivative turns positive again. An inverse problem built around a single image should check whether its measurement time has landed close to a zero of the sensitivity.

Verify the derivative without crossing an unreported event

Use the graph to compare a two-sided finite difference of full trajectories with the analytic tangent. Why does disagreement form a narrow interval around impact, and why does unlimited step reduction fail at a grazing crossing?

Work through the solution

Compute \(D_\eta=[y(T;h+\eta)-y(T;h-\eta)]/(2\eta)\) at the same observation time in both runs. Away from the event, both follow the same smooth sequence of modes and the difference tends to the analytic tangent as \(\eta\) decreases. Near impact one run can still be falling while the other is already rebounding. Its finite difference mixes two branches and rounds off the jump between one-sided derivatives. Narrowing the perturbation shrinks this region. At exactly the nonsmooth observation time a unique classical derivative need not exist. The central value there cannot be taken as evidence that the analytic tangent on either smooth side is wrong.

Explore the related calculation with adjustable inputs. Change the parameters in the experiment on this same project page and compare its output with this part of the derivation.

Start with a one-percent perturbation and reduce it while monitoring a time well after the first bounce and before the second. At sufficiently small perturbations event-location tolerance and cancellation in subtraction become visible in a floating-point solver. For a nearly tangent hit the denominator \(n^TF^-\) approaches zero, and small perturbations can remove or insert an event entirely. The event sequence and its transversality are part of a sensitivity report, just as step size and integrator order are part of a trajectory calculation.

Nathan Kong and colleagues derive saltation matrices for hybrid dynamics and discuss event timing.

Notebook practice · A constrained integrator can get the circle right and the clock wrong