From first principles
Derive a reversible position update from Newton’s law
For a force that depends only on position, \(m\ddot q=F(q)\), the acceleration can be evaluated at a stored position without an implicit solve. Expand the exact position one step forward and one step backward about the same time \(t_n\). The odd derivatives reverse sign and cancel when the expansions are added:
Replace acceleration by force divided by mass and solve for the forward position. The resulting relation is unchanged if the labels \(n+1\) and \(n-1\) are exchanged:
Introduce the staggered momentum \(p_{n-1/2}=m(q_n-q_{n-1})/h\). The same algebra becomes an impulse followed by a drift,
A specified momentum at \(t=0\) starts the first half step with \(p_{1/2}=p_0+h F(q_0)/2\). For smooth forces the method has second-order position accuracy. It is important to distinguish the staggered momentum from momentum at the stored position time when checking energy.
Derivation and applications
Why a stable Verlet trajectory can arrive at the wrong time
Long-term energy behaviour is important in reversible mechanics, but phase error can dominate a timing measurement. Consider the velocity-independent linear oscillator \(q''=-\omega^2q\). Use a uniform step \(h\), an accurately initialized first point and the position recurrence obtained by eliminating the half-step momenta in Verlet. Write \(z=h\omega\):
Assume a discrete mode \(q_n=e^{in\vartheta}\). Divide by the mode value at \(n\) and combine the two exponentials. The angle advanced per step obeys
For \(0<z<2\) choose the branch continuous with the exact oscillation at small \(h\). The discrete angular frequency and its expansion are
The numerical oscillator runs slightly fast even though its amplitude can remain bounded indefinitely. Its phase lead grows approximately linearly with elapsed time at fixed step. Above \(z=2\) the dispersion relation permits no real phase angle, signaling a separate stability failure. The formula concerns time discretization alone; incorrect initial half-step velocities can add an initial phase offset.
Worked example
Estimate a ten-period timing error
For \(\omega=5.00\) rad/s and \(h=0.100\) s, \(z=0.500\) and \(\widetilde\omega=20\arcsin(0.250)=5.054\) rad/s. Ten true periods last \(12.57\) s. Over that duration the numerical phase gains about \((5.054-5.00)(12.57)\simeq0.674\) rad. The estimated time at which the numerical oscillator completes its tenth period is \(20\pi/5.054=12.43\) s, about \(0.13\) s too soon.
Second application
Select a step from a phase requirement
Suppose 100 periods should accumulate less than \(0.100\) rad of phase error. The leading estimate gives \(2\pi(100)z^2/24<0.100\), so \(z<0.0618\). For \(\omega=5.00\) rad/s this means \(h<0.0124\) s. A choice based only on the stability requirement \(h<0.400\) s would be far too coarse. Halving a small step should reduce the accumulated phase error by approximately four at fixed physical duration.
Position and momentum at staggered times
For unit mass and a time-independent potential \(V(q)\), the equations are
Treat the potential force over a half step, drift with the updated momentum for a full step, then use the new position for the last half kick. This yields
Successive half kicks at the same position share a force evaluation. Reversing the sign of \(h\) exactly undoes the steps in reverse order, in exact arithmetic. Subtracting consecutive position increments gives
The starting position and velocity must initialise the very first half step correctly; using the full velocity as the half-step velocity injects an initial phase error.
The oscillator has an exactly computable modified energy
For \(V=\omega^2q^2/2\) define \(z=h\omega\). The position coefficient of \(q_n\) after one step is
the momentum coefficient of \(q_n\) is \(-h\omega^2(1-z^2/4)\). The full map has equal diagonal entries \(a\) and off-diagonal entries \(h,-hc\) with \(c=\omega^2(1-z^2/4)\). Since \(a^2+h^2c=1\), expanding squares shows \(p_{n+1}^2+cq_{n+1}^2=p_n^2+cq_n^2\).
When \(0<z<2\), \(c>0\) and level sets of this invariant are bounded ellipses. The eigenvalues are \(e^{\pm i\theta}\) with \(\cos\theta=a\). Beyond two, one real eigenvalue has magnitude greater than one and trajectories generically grow. At exactly two the invariant loses control of position and a repeated eigenvalue can cause linear growth. An apparently bounded run starting from specially chosen data at the threshold cannot certify stability for arbitrary perturbations.
Follow a step and its timing
For \(\omega=1,h=1,q_0=1,p_0=0\), the half kick gives \(-0.5\), the drift gives \(q_1=0.5\), and the final half kick gives \(p_1=-0.75\). The physical energy decreases from 0.5 to 0.40625 in this first step. The modified energy \((p^2+0.75q^2)/2\) equals 0.375 at both points. The discrete phase is \(\theta=\pi/3\), so the computed trajectory returns after six steps. The true oscillator returns after \(2\pi\approx6.283\) seconds. A stable trajectory with a bounded energy error can therefore accumulate a large timing error over many cycles.
For small \(z\), expanding \(\theta=2\arcsin(z/2)\) gives
At a fixed final time the accumulated phase error is therefore second order in \(h\). A period estimate and an energy trace probe different aspects of long-time integration and should be reported separately.
Why the initial velocity test matters
A test with only the initial position nonzero may conceal the borderline instability at \(h\omega=2\). At that boundary the update is
For \(p_0=0\) the positions merely alternate sign forever. With \(q_0=0\) and \(p_0=1\), however, explicit iteration gives
The position magnitude grows linearly. A stability test must account for all independent starting directions or small perturbations of the chosen one, especially when an eigenvalue of modulus one is repeated.
Prove conservation of angular momentum by individual substeps
For a particle of constant mass in a radial potential \(V(\|q\|)\), the force is parallel to the position vector. Its angular momentum is \(L=q\times p\). During a kick of duration \(\tau\), momentum changes by \(\tau F(q)\) at fixed position, so the change in \(L\) is
During a drift, position changes by \(\tau p/m\) at fixed momentum, giving change \((\tau/m)p\times p=0\). The full kick–drift–kick map therefore preserves angular momentum exactly in arithmetic without rounding, for any step length for which these evaluations are defined.
The proof uses radial force and the relationship between velocity and momentum. An external noncentral force exerts a physical torque, while a coordinate-dependent mass matrix changes the drift subflow. Under either modification the two zero cross products need rechecking. The argument also gives no bound on energy or phase. Exact conservation of angular momentum constrains orbital geometry but leaves freedom to move from the correct energy level onto a nearby one or to return to a point on the orbit at the wrong time.
Compare three diagnostics on an elliptical oscillator trajectory
Use unit mass and two-dimensional potential \(V=(x^2+y^2)/2\). Start at \(q=(1,0)\), \(p=(0,2)\), so \(L=2\) and physical energy is
At step \(h=0.5\), the first half kick gives
The drift leads to \(q_1=(0.875,1)\). The last half kick subtracts \(0.25q_1\), giving \(p_1=(-0.46875,1.75)\). The resulting planar angular momentum is \(0.875(1.75)-1(-0.46875)=2\), exactly as proved.
Calculate energy separately. The squared position is \(0.875^2+1=1.765625\), and the squared momentum is
Hence the physical energy after this step is 2.52392578125, about 0.96 percent above the initial value. The exact continuous position at this time is \((\cos0.5,2\sin0.5)\approx(0.87758,0.95885)\), so the position error is concentrated in the second coordinate. Angular momentum, physical energy and the individual trajectory coordinates expose three distinct properties of the same update.
Because the harmonic force is separable by coordinate, the modified invariant from the scalar oscillator adds across the two directions: \([\|p\|^2+(1-h^2/4)\|q\|^2]/2\) is constant. Substitution gives 2.46875 at both steps, independently checking the arithmetic. For a general radial potential this particular quadratic modified invariant no longer follows, while the angular momentum proof remains valid. A conservation claim should identify the symmetry responsible rather than assuming every observed invariant survives a change of potential.
If there were a small constant transverse force, the physical change in angular momentum would be the time integral of \(q\times F_{\rm ext}\). A better diagnostic would subtract the accumulated applied torque from the measured change in \(L\), rather than demand that \(L\) remain fixed. This distinction also guards against a subtle implementation error: zeroing a real torque to improve a conservation plot would change the physical problem and could hide a significant trajectory bias.
Measuring the signed torque makes its direction as well as its magnitude available for this balance check.
Estimate the phase error of a stable Verlet orbit
Eliminate momentum from velocity Verlet for the harmonic oscillator. A discrete sinusoid obeys \(\cos\theta=1-(h\omega)^2/2\). Its angular frequency is \(\theta/h\); divide by \(\omega\) before comparing steps.

Read values from the plot
| Step × physical angular frequency | Discrete frequency | Small-step expansion |
|---|---|---|
| 0.01 | 1 | 1 |
| 0.505 | 1.0109 | 1.0106 |
| 1 | 1.0472 | 1.0417 |
| 1.495 | 1.1295 | 1.0931 |
| 1.99 | 1.4781 | 1.165 |
Change parameters · Estimate the phase error of a stable Verlet orbit
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.