Figure-eight orbit

step 0
Loading the engineShared by all simulations, so the next one opens instantly.
The physics

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 𝒜︀=∫0TLdt 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 G=1 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

𝐫¨i=G∑j≠imj(𝐫j−𝐫i)(|𝐫j−𝐫i|2+ε2)3/2

The softening length ε removes the singularity at zero distance. The bodies on this orbit never come close to each other, so the default ε=10−4 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.