Figure-eight orbit
This simulation needs WebAssembly, and it could not start in this browser.
The image is a frame from a real run. Check that JavaScript is on, or try another browser.
Most ways of starting three bodies under gravity end in chaos. A few lead to choreographies: periodic orbits in which three equal masses run along one closed curve, a third of a period apart. The best known is the figure-eight. Cristopher Moore found it numerically in 1993, and in 2000 Alain Chenciner and Richard Montgomery proved that it exists by minimizing the action over loops with the symmetry of a figure eight.
What you see
Three equal masses chase each other around the same figure-eight, and their trails draw the curve. Each body passes through the central crossing in turn. The total angular momentum of this orbit is zero.
Classic figure-8: the published initial conditions, in units where and each mass is 1. By default they are integrated with the leapfrog scheme (velocity Verlet), which is symplectic: the energy error stays bounded instead of drifting.
Slightly perturbed: the same start with one body moved by 0.001 length units. Numerical studies by Carles Simó showed that the figure-eight is linearly stable, so a nudge this small makes the curve wobble around the original rather than break it up.
Governing equation
The softening length removes the singularity at zero distance. The bodies on this orbit never come close to each other, so the default has no visible effect.
Parameters
timestep dt: the integration step, 0.0001 to 0.02 (default 0.005). Smaller steps are more accurate and slower; the orbit needs a fine step to close cleanly over many periods.
softening ε: the length above. Keep it small for the choreography; larger values blunt close encounters.
integrator: leapfrog by default. Of the alternatives, yoshida4 is a fourth-order symplectic method, rk4 is more accurate per step but lets the energy drift slowly, and euler drifts fast.