From first principles
Build an oscillator update out of two area-preserving shears
Take one undamped oscillator of mass \(m>0\) and stiffness \(k>0\). Its canonical position \(q\) and momentum \(p\) satisfy
Exact trajectories run along energy ellipses and preserve phase-plane area. If both slopes are taken at the left endpoint, the update and its area factor are
A positive factor greater than one at each step makes the numerical orbit spiral outward. Instead update the momentum at fixed position, then move the position using that new momentum. Both operations are shears:
The product matrix has diagonal entries \(1-h^2k/m\) and \(1\), with off-diagonal product \(-h^2k/m\), giving determinant one. Its eigenvalues form a conjugate pair on the unit circle when \(|2-h^2k/m|<2\). This calculation explains the bounded oscillatory behaviour for \(0<h\sqrt{k/m}<2\). Preserving area alone would also allow one real mode to grow while another shrinks. It does not establish either stability or exact conservation of the original energy.
Background · Symplectic map
This is preservation of the canonical symplectic form. It provides control of long-time structure without guaranteeing that every trajectory has the exact phase.
Derivation and applications
Which quadratic energy does symplectic Euler preserve?
An undamped linear oscillator conserves the physical sum of kinetic and potential energy. A geometric time integrator may conserve a nearby quadratic form instead. Take \(q''=-\omega^2q\) with constant \(\omega\) and unit mass. Scale velocity by setting \(u=\dot q/\omega\) so that both variables have units of length, and write \(z=h\omega\). Use the kick-then-drift version of symplectic Euler. Its step is two triangular shears:
To find a preserved quantity, test a quadratic form \(I=q^2+u^2+\alpha qu\). The changes of the ordinary sum and the product follow directly by multiplication and collection:
Choosing \(\alpha=-z\) cancels the entire change at every step. Completing the square identifies the range where the invariant confines trajectories to closed ellipses:
For \(|z|<2\) the form is positive definite. The physical energy is proportional to \(q^2+u^2\) and can oscillate, but the invariant bounds it. As \(h\to0\) the tilted ellipse approaches the exact energy circle. At the endpoint \(|z|=2\) the quadratic form ceases to bound both variables; preservation of an indefinite form alone does not guarantee stable trajectories.
Worked example
Follow a moderate step exactly
Take \(\omega=2.00\) s⁻¹, \(h=0.250\) s, \(q=1.00\) m and \(u=0\). Then \(z=0.500\), \(u'=-0.500\) m and \(q'=0.750\) m. The ordinary sum falls from \(1.00\) to \(0.8125\) m². But \(I'=0.8125-0.500(0.750)(-0.500)=1.00\) m². A plot restricted to physical energy at one time could mistake the discrepancy for damping.
Second application
Diagnose a seemingly exact conservation test outside stability
Choose \(z=2.50\) and the same initial \((q,u)=(1,0)\). One step gives \((-5.25,-2.50)\). The ordinary sum is \(33.8125\), whereas the cross term is \(2.50(13.125)=32.8125\), so \(I'=1\). The invariant remains exact while the amplitude grows. Testing positivity of the conserved quadratic form therefore supplies information absent from a conservation-only check.
Choose the diagnostic before choosing the method
A mass on an ideal spring with unit mass and stiffness obeys \(\dot q=p,\ \dot p=-q\). The state moves on circles with conserved energy \(H=(q^2+p^2)/2\). At short times a state norm measures trajectory error, but over many periods there are independent questions about amplitude, phase and energy. A time-stepping method that systematically increases the orbit radius can produce an artificial runaway even on this simplest stable physical system.
Forward Euler updates \(q_{n+1}=q_n+hp_n,\ p_{n+1}=p_n-hq_n\). Square and add: the cross terms cancel, leaving \(H_{n+1}=(1+h^2)H_n\). The phase space area factor of the update matrix is its determinant \(1+h^2\), also greater than one. Backward Euler instead contracts energy by \(1/(1+h^2)\). The second method is stable in the sense of bounded states, but it removes mechanical energy from an undamped model. The sign of drift explains much more here than a solitary endpoint comparison.
Update momentum before position
The momentum-first symplectic Euler scheme sets \(p_{n+1}=p_n-hq_n\) and \(q_{n+1}=q_n+hp_{n+1}\). Its update matrix in \((q,p)\) has rows \((1-h^2,h)\) and \((-h,1)\). Its determinant is one and trace is \(2-h^2\). For \(0<h<2\), the two eigenvalues are a complex conjugate pair of unit magnitude because their product is one and the trace lies strictly between −2 and 2. The resulting numerical frequency satisfies
Thus phase error still accumulates even if the amplitudes remain bounded.
Direct substitution also verifies an exact discrete invariant \(\tilde H=(q^2+p^2-hqp)/2\). For \(h<2\) the corresponding quadratic form is positive definite, so constant \(\tilde H\) confines the state to an ellipse. The exact physical energy can fluctuate around its initial level as the point moves around that ellipse. Area preservation alone would not guarantee this behaviour: for \(h>2\) the determinant remains one but real reciprocal eigenvalues permit growth. The eigenvalue and invariant calculations supply the missing qualification.
Check a long-time forecast with numbers
Start at \((q,p)=(1,0)\) with \(h=0.1\). Forward Euler gives \((1,-0.1)\) and \(H=0.505\) after one step. After 100 steps the exact multiplicative law predicts
Symplectic Euler instead gives \((0.99,-0.1)\), \(H=0.49505\), but \(\tilde H=0.5\) again. The first step alone might suggest that the second scheme dissipates energy. The invariant predicts that the decrease cannot continue monotonically over many periods.
Implicit midpoint, \((y_{n+1}-y_n)/h=J(y_n+y_{n+1})/2\) with the skew-symmetric oscillator matrix \(J\), preserves the exact quadratic energy. Dot both sides with the midpoint state. The left side is proportional to \(H_{n+1}-H_n\) and the right side is zero by skew symmetry. Its rotations need not accumulate the exact physical phase, since the rotation angle per step is \(2\arctan(h/2)\). A meaningful long-time study therefore records measured period, energy range and reversibility alongside any state error after a specified number of cycles.

Test an algorithm by reversing the clock
A method is time symmetric if taking a step of length \(h\) and then a step of length \(-h\) restores the starting state, up to arithmetic and solve tolerance. For the midpoint update, exchanging the old and new values leaves their average unchanged and changes both sides of the difference equation consistently. This gives exact reversibility for an accurately solved implicit step. For forward Euler on the oscillator, the product of the forward and backward matrices is \((1+h^2)I\), so reversal actually scales the state.
At \(h=0.1\), the simple reversal from \((1,0)\) therefore returns \((1.01,0)\) for forward Euler, making the failure visible in one pair of steps. This diagnostic is useful only for a reversible underlying evolution paired with its time-reversed integration law. A dissipative or dissipatively constrained physical system has different requirements. Reversibility, energy preservation and phase accuracy probe separate mathematical properties, each with a different operational test.
Test a flow map on a small cell of phase space
For canonical coordinates \(z=(q,p)\), a differentiable Hamiltonian update \(z_+=\Psi(z)\) is symplectic when its Jacobian \(D\Psi\) preserves the matrix \(J=\left(\begin{smallmatrix}0&1\\-1&0\end{smallmatrix}\right)\) through \(D\Psi^T J D\Psi=J\). Direct multiplication shows that for any real two-by-two matrix \(M\), \(M^TJM=(\det M)J\). Thus in one degree of freedom symplecticity is equivalent to preserving oriented area. A small rectangle of nearby initial conditions should map to a region of the same signed area even when its sides stretch or tilt.
For more than one degree of freedom, preserving ordinary volume is necessary but no longer sufficient. A map may stretch one canonical \((q,p)\) plane and compress another by the reciprocal factor. Its full determinant remains one while the area pairing in each plane changes. Energy is a further, independent diagnostic: an area-preserving map can move individual points among nearby energy contours. The determinant calculation tests a geometric property of the map across neighbouring trajectories, rather than just the energy at one chosen state.
Compare the phase volume of an oscillator ensemble
For \(q'=p,\ p'=-q\) with unit frequency, forward Euler gives \(M=\left(\begin{smallmatrix}1&h\\-h&1\end{smallmatrix}\right)\), of determinant \(1+h^2\). Backward Euler gives \((I-hA)^{-1}\), where \(A\) has off-diagonal entries \(1,-1\), so its determinant is \(1/(1+h^2)\). A kick followed by a drift gives the symplectic Euler matrix with rows \((1-h^2,h)\) and \((-h,1)\), whose determinant is exactly one. These facts hold for every input rectangle, so they can be checked by integrating its corners rather than relying on a single solution.
Choose \(h=0.2\) and an initial ensemble occupying a rectangle of area 0.01 in normalised phase coordinates. After 25 steps forward Euler predicts area \(0.01(1.04)^{25}\approx0.02666\). Backward Euler gives \(0.01/(1.04)^{25}\approx0.00375\). Symplectic Euler preserves 0.01. Repeated steps compound even a four percent per-step area change into a substantial distortion. For the oscillator all three approximate individual paths can initially look plausible, so this ensemble diagnostic reveals information inaccessible in a short plot of one coordinate.
As a counterexample in four dimensions, scale the first pair of coordinates by \((2,1)\) and the second pair by \((1/2,1)\). The volume multiplier is one, but the first canonical area doubles while the second halves. A full symplecticity test must check \(M^TJM-J\) using the correctly ordered canonical coordinate pairs. An algorithm preserving volume in an arbitrary collection of engineering state units is not automatically qualified for long-time Hamiltonian integration.
Area preservation also survives composing individual canonical shears: the determinants multiply and every shear has determinant one. This explains why reversing the order of a kick and a drift changes the phase error but preserves the two-dimensional area test. The two compositions may therefore produce different numeric positions while agreeing precisely on one geometric invariant. A useful verification suite includes both ensemble area and a trajectory observable with a known time dependence.
Change parameters · Energy and geometric integration
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.