Fundamentals / Numerical mathematics / Numerical ordinary differential equations

Long trajectories and sensitivities

Check numerical phase, derive the tangent contribution from initial data, and verify an adjoint for an accumulated observation.

Predict a numerical period

For velocity Verlet with \(h=0.5\), \(\omega=2\), compute the stability indicator and period in time units. Starting with \(q=0,p=2\), give the first step and verify the modified energy.

Worked solution

\(z=h\omega=1\) gives \(\cos\theta=1-1/2=1/2\), hence \(\theta=\pi/3\). Six steps make a period of 3 time units, versus the exact period \(\pi\).

The first half kick is zero, the drift gives \(q=1\), and the last half kick leaves \(p=1\). With \(c=4(1-1/4)=3\), the modified energy \((p^2+3q^2)/2\) takes the value 2 at both states.

Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Initial data also carry the parameter

For \(y'=-\alpha y,\ y(0)=\alpha\), find \(S=\partial y/\partial\alpha\) directly and from its differential equation. At what positive observation time is the first-order sensitivity zero if \(\alpha=2\)?

Worked solution

Direct differentiation of \(y=\alpha e^{-\alpha t}\) gives

\[S=e^{-\alpha t}(1-\alpha t).\]

The tangent equation is

\[S'=-\alpha S-y,\]

with \(S(0)=1\). Its integrating factor produces

\[e^{\alpha t}S=1-\alpha t.\]

At \(t=1/\alpha=0.5\), the initial-amplitude increase and the increased decay rate cancel to first order. Setting the initial tangent to zero would miss this cancellation completely.

Explore the related calculation with adjustable inputs. Compare the derivative of the actual discrete trajectory with the continuous derivative as the time grid changes; include any initial-state derivative required by the present problem.

An accumulated output

Let \(y'=\alpha\), \(y(0)=0\), \(Q=\int_0^T y(t)\,dt\). Compute \(dQ/d\alpha\) directly. Derive an adjoint with terminal value zero by integrating \(zS'\) by parts, and check \(T=3\).

Worked solution

The trajectory is \(\alpha t\), so \(Q=\alpha T^2/2\). The tangent satisfies \(S'=1\), \(S(0)=0\). To recover \(\int S\), choose \(-z'=1,\ z(T)=0\), giving \(z=T-t\).

Integration by parts yields \(\int_0^T S=\int_0^T zS'\) because the boundary product vanishes. Integrating \(T-t\) gives \(T^2/2=4.5\) for \(T=3\), the same gradient.

Explore the related calculation with adjustable inputs. Compare the derivative of the actual discrete trajectory with the continuous derivative as the time grid changes; include any initial-state derivative required by the present problem.