Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.A map of every possible state
A swinging pendulum’s state is two numbers: where it is (angle) and how much it’s moving (momentum). Plot them as a point on a map, phase space, and the motion becomes a path on that map. Each path stays on a line of constant energy. If you start a whole cloud of slightly different pendulums, the cloud stretches and swirls, but its area never changes. That hidden rule is one of the deepest facts in physics.
Long-horizon orbit propagation, molecular simulation and particle accelerators all rely on integrators that respect Hamiltonian structure. Hamiltonian Monte Carlo (a5-2-8) samples Bayesian posteriors by simulating fictitious Hamiltonian dynamics. Hamiltonian neural networks learn energy-conserving models of robots and physical systems from data.
- 1. A pendulum's phase space has axes…
- 2. Without friction, each phase-space path stays on…
- 3. A cloud of starting states in phase space keeps its…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.From Lagrange to Hamilton
Define the momentum and the Hamiltonian (Legendre transform) . For , this is , the total energy. The equations of motion are
For a spring () these give and .
Energy is conserved
(for H without explicit time dependence).
- 1. For L = ½mq̇² − V, H equals…
- 2. ṗ equals…
- 3. For a spring with k = 50 N/m at q = 0.1 m, ṗ =
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Phase-space geometry
- Each trajectory lies on a level set of H. For the pendulum (), closed curves are swings and open curves are full rotations. The dividing separatrix has energy : just enough to reach the top. With m = l = 1, the bob needs 6.26 m/s at the bottom.
- Liouville’s theorem: the Hamiltonian flow preserves phase-space volume. The divergence of is .
- Poisson bracket: , with and . Conserved quantities are exactly those that Poisson-commute with H.
Symplectic integrators
A symplectic method maps phase space to itself with an area-preserving (symplectic) map. Leapfrog, or velocity Verlet, makes a half kick, a full drift, then a half kick:
It is only 2nd-order accurate. But it exactly conserves a slightly modified Hamiltonian, so its energy error stays bounded forever instead of drifting (Hairer, Lubich and Wanner, 2006). Explicit Euler multiplies phase-space area by about each step for a harmonic oscillator, spiralling outward.
- 1. Liouville's theorem says the Hamiltonian flow preserves…
- 2. Leapfrog's energy error over very long runs…
- 3. {q, p} =
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Deriving Hamilton’s equations
, using and Euler–Lagrange . Reading off the coefficients gives and . ∎
Leapfrog is symplectic
Each kick and each drift is a shear with Jacobian determinant 1. A composition of shears has determinant 1. ∎
Why Euler drifts
For the oscillator (m = k = 1), the explicit Euler step is the matrix with determinant . Energy grows by that factor every step: after 100 steps of h = 0.1, ×2.70.
- 1. Each leapfrog sub-step is a…
- 2. Explicit Euler on an oscillator multiplies energy per step by…
- 3. The Hamiltonian is obtained from L by…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.200 orbits: order isn’t everything
An orbit with eccentricity 0.5 is integrated for 200 periods at 80 steps per orbit.
- Leapfrog: angular momentum is conserved to 2 × 10⁻¹⁴ (round-off), because a central force and the kick–drift structure preserve it exactly. Its energy error oscillates but stays below 8.5 × 10⁻³, no worse at the end than at the start.
- RK4: although 4th order, its energy error grows 36× from the first ten orbits to the last ten, reaching 9.0 × 10⁻³. Its angular momentum drifts to 2.4 × 10⁻³.
For long-term solar-system integrations, molecular dynamics and HMC, symplectic integrators are the standard choice (Wisdom and Holman, 1991). High-order non-symplectic methods win only over short horizons or with tight adaptive error control.
Hamiltonian mechanics in AI, robotics and aerospace
- Sampling: Hamiltonian Monte Carlo and NUTS simulate leapfrog dynamics to explore posteriors efficiently (Neal, 2011).
- Learning physics: Hamiltonian neural networks (Greydanus, Dzamba and Yosinski, 2019) and symplectic recurrent networks learn H and conserve energy by construction.
- Aerospace: long-term orbit propagation, symplectic maps for solar-system dynamics, and accelerator beam dynamics.
- Control: port-Hamiltonian models for energy-based robot control.
References
- H. Goldstein, C. Poole, J. Safko (2002). Classical Mechanics, 3rd ed. Addison-Wesley.
- E. Hairer, C. Lubich, G. Wanner (2006). Geometric Numerical Integration, 2nd ed. Springer.
- J. Wisdom, M. Holman (1991). “Symplectic maps for the n-body problem.” Astronomical Journal, 102.
- R. Neal (2011). “MCMC using Hamiltonian dynamics.” In Handbook of Markov Chain Monte Carlo. CRC Press.
- S. Greydanus, M. Dzamba, J. Yosinski (2019). “Hamiltonian neural networks.” NeurIPS.