Phase Space (q, p)
Energy Error over Time
Position over Time
Max Energy Error (log scale)
Symplectic Geometry and Energy Conservation
Hamiltonian mechanics lives on phase space (q,p) with the symplectic form ω=dq∧dp. A symplectic integrator preserves this 2-form exactly — it's a map that preserves area in phase space.
The Störmer-Verlet (leapfrog) method: p_{n+1/2} = pₙ − h/2·∂H/∂q, then q_{n+1} = qₙ + h·∂H/∂p|_{n+1/2}, then p_{n+1} = p_{n+1/2} − h/2·∂H/∂q(q_{n+1}). It is symplectic and time-reversible.
Euler's method is NOT symplectic — it spirals outward, gaining energy. RK4 is accurate to O(h⁴) per step, but also not symplectic — energy drifts over long times.
Symplectic integrators don't conserve energy exactly, but they conserve a modified Hamiltonian exactly — so energy stays bounded (no drift) forever. This makes them ideal for long-time simulations in celestial mechanics, molecular dynamics, and accelerator physics.