Part 2 of 11 of the research log of my 2024 summer project on the three-body problem, at the University of Edinburgh, supervised by Prof. Jenni Smillie.
Previous: Plotting and Visualising the Three-Body Problem
Next: Ellipses and the Two-Body Problem
This post explains what makes an integrator symplectic, and compares second-, third- and fourth-order symplectic schemes on the figure-eight orbit.
What is a symplectic integrator?
Start from Liouville’s theorem in Hamiltonian mechanics: the flow of a Hamiltonian system preserves phase-space volume. For one degree of freedom, a small region of the \((x, p)\) plane keeps the same area as it evolves, \(dA = dA'\):

So evolving Newton’s equations forward by a finite time defines an area-preserving (more generally, symplectic) map of phase space. A symplectic integrator is a numerical method whose single step is itself a symplectic map.
This matters for long simulations. A symplectic integrator does not conserve the energy exactly. What it conserves, up to an error that shrinks exponentially as the step is reduced, is a slightly modified (“shadow”) Hamiltonian, so the computed energy oscillates within a fixed band instead of drifting. Non-symplectic methods such as the explicit Euler method and RK4 show a steady energy drift.
Checking whether a scheme is symplectic
For one degree of freedom, write a step of a linear scheme as
\[\begin{pmatrix} x_{n+1} \\ p_{n+1} \end{pmatrix}=A\begin{pmatrix} x_n \\ p_n \end{pmatrix}.\]The scheme is symplectic if and only if \(\det A = 1\). For a nonlinear scheme the same test is applied to the Jacobian of the map, and in higher dimensions the condition becomes \(M^{T}JM = J\) for the Jacobian \(M\) and the standard symplectic matrix \(J\).
Higher-order schemes
A family of explicit symplectic schemes splits each time step \(\Delta t\) into \(n\) stages. Stage \(i\) first moves the positions with the current velocities (a drift) and then updates the velocities with the accelerations at the new positions (a kick):
\[\begin{aligned} \mathbf{x}_{i}&=\mathbf{x}_{i-1}+c_i\, \mathbf{v}_{i-1}\, \Delta t, \\ \mathbf{v}_{i}&=\mathbf{v}_{i-1}+d_i\, \mathbf{a}\left(\mathbf{x}_{i}\right) \Delta t . \end{aligned}\]Each drift and each kick is a symplectic map, so their composition is symplectic as well, and the coefficients \(c_i\) and \(d_i\) set the order of accuracy. Velocity Verlet is the case \(c = (0, 1)\), \(d = \left(\tfrac{1}{2}, \tfrac{1}{2}\right)\). A third-order scheme (Ruth) uses
\[c = \left(1, -\tfrac{2}{3}, \tfrac{2}{3}\right), \qquad d = \left(-\tfrac{1}{24}, \tfrac{3}{4}, \tfrac{7}{24}\right),\]and a fourth-order scheme (Forest–Ruth) uses
\[\begin{aligned} c &= \biggl(\frac{1}{2(2 - 2^{1/3})},\ \frac{1 - 2^{1/3}}{2(2 - 2^{1/3})}, \\ &\qquad \frac{1 - 2^{1/3}}{2(2 - 2^{1/3})},\ \frac{1}{2(2 - 2^{1/3})}\biggr), \\ d &= \left(\frac{1}{2 - 2^{1/3}},\ -\frac{2^{1/3}}{2 - 2^{1/3}},\ \frac{1}{2 - 2^{1/3}},\ 0\right). \end{aligned}\]The order of the two updates within a stage matters. With these coefficients, kicking before drifting is still symplectic but much less accurate than Verlet: on the test below its energy deviation is of order \(10^{-3}\) to \(10^{-2}\).
Accuracy of the higher-order schemes
I integrated the figure-eight orbit for \(50\,000\) steps with \(\Delta t = 0.01\), about 79 periods, and recorded the energy deviation \((E_{\max} - E_{\min})/\lvert E_0\rvert\):
| Scheme | Order | Energy deviation |
|---|---|---|
| Velocity Verlet | 2 | \(5.9 \times 10^{-5}\) |
| Ruth | 3 | \(4.1 \times 10^{-8}\) |
| Forest–Ruth | 4 | \(1.9 \times 10^{-8}\) |
The higher-order schemes improve the energy conservation by more than three orders of magnitude, at three force evaluations per step where Verlet needs one. Spending the same effort on Verlet, with a step three times smaller, reduces its deviation only by a factor of nine, to \(6.6 \times 10^{-6}\).
Momentum conservation
Every kick adds equal and opposite impulses to each pair of bodies, so all of these schemes should conserve the total linear momentum to round-off precision. In the first version of my code they did not. The error was small, but it grew steadily with time:

The cause was a bug in the code, not the integrator: the variable that accumulates the momentum components was not reset to zero at each time step. After the fix the error stays at the level of floating-point round-off:

A perturbed figure-eight
Starting close to the figure-eight, but not on it, gives an orbit that keeps the figure-eight shape for many periods while the whole pattern slowly rotates:

Credits
The section on the definition of symplectic integrators, including the figure, is based on these notes on the leapfrog method by Peter Young.
Revised on 25 October and 11 November 2026. The numbers were right, but the original wrote each stage as a kick followed by a drift. With the coefficients quoted, that order gives a much less accurate scheme. The code moved the positions first, which is the order now given, and it reproduces the energy deviations in the table. The definition of the energy deviation and the cause of the momentum error (moved here from part 4) were added, and the errors are rounded to two figures.
Filed under Numerical Methods, Research, Three-Body Problem.