Hamilton's equations for the three systems
Unit mass and scaled units let the three conservative systems be compared directly. The harmonic frequency and the Kepler gravity parameter are both one.
M084 · Geometry of numerical integrators
When a computer simulates an orbit, can a small energy error hide a wrong trajectory? It can. A symplectic integrator, one built to respect the structure of Hamilton's equations, keeps the energy error small and bounded for a very long time. The computed body can still drift away from the true trajectory, running ahead of or behind it along the orbit. Energy behavior, accuracy, symplectic structure and time reversibility are separate properties; check each one.
Run Euler, RK4, symplectic Euler and Verlet side by side. Compare how closely each follows the true phase or orbit over long times, how its energy drifts, and whether its step map keeps the local canonical geometry and runs backward correctly. Then halve the step and take on a Kepler periapsis where the motion changes fast.
Physics tutorial
BackgroundA numerical method replaces continuous Hamiltonian motion with a discrete map that carries the canonical coordinates forward one step at a time.
Why it mattersGeometric numerical integration asks which structures of the true motion a discrete method keeps, and what that means over long runs.
Start with the essentials
Unit mass and scaled units let the three conservative systems be compared directly. The harmonic frequency and the Kepler gravity parameter are both one.
Symplectic Euler is first order. It differs from explicit Euler because the drift uses the momentum that was just updated.
Splitting the kick into two halves gives a second-order, time-reversible map. That does not conserve the true Hamiltonian exactly, and it does not make a periapsis taken in too few steps accurate.
The readout gives the largest deviation of any matrix entry, estimated with central differences. In four dimensions, a determinant of one is a weaker test on its own. The Kepler patch is a two-dimensional projection and never measures the full phase-space volume.
The maximum energy error uses every step, but the plots keep at most about 600 samples per method. A steady energy curve can hide a phase error that keeps growing. A record that stops is not extended with a prediction.
One shared logarithmic scale shows tiny and large errors together and keeps the sign of the energy drift. Nominal cycles use a reference period of two pi in scaled time. The pendulum reference compares runs with 32 and 64 RK4 substeps in each coarse step.
Typical misconceptionIf the energy error is small, the orbit must be right.
Better mental modelPhase error can build up while the energy stays nearly constant. Compare with the reference state at the same times.
Typical misconceptionA symplectic method conserves the exact Hamiltonian at every step.
Better mental modelWhen the fixed step resolves the motion, the energy error usually oscillates within bounds, but the true energy is still not conserved exactly.
Typical misconceptionPreserving the geometry makes up for a large time step.
Better mental modelThe fast pass close to the centre still needs a short step. Halve the step and compare the orbit error, not just the determinant.
Typical misconceptionIf the projected Kepler patch keeps its area, the method is symplectic.
Better mental modelKepler phase space has four dimensions. The full matrix test gives the relevant local evidence.
Review a full harmonic record and switch the selected method.
What to observe: Every color uses the same step, yet the energy behaves differently: it grows, drifts or oscillates within bounds.Use the long RK4 record, then halve the fixed step.
What to observe: Both the state error and the energy drift change with the step size. A high local order is not the only thing that matters.Compare the large-amplitude libration and rotating pendulum presets.
What to observe: The reference here is a refined numerical solution, not a harmonic approximation.Compare a resolved and an unresolved periapsis, check the full-map defect, then halve the step.
What to observe: A symplectic map can keep its geometry and still give a poor trajectory.