Three bodies
Three equal masses under Newtonian gravity, simulated live in your browser. Start from a ready-made orbit or type in your own positions and velocities, then drag, fork and zoom to see how quickly three bodies become unpredictable.
Custom scenario
Units: G = 1, every mass = 1. Choosing a preset fills these fields, so you can tweak its numbers.
How to use it
- Presets
- Binary + orbiter is a tight pair with a distant third body circling both. Figure-eight, butterfly, moth, yin-yang and dragonfly are periodic orbits. Triangle and Random are unstable on purpose.
- Drag
- Grab a body and drop it somewhere else. Its velocity is set to zero and the energy baseline restarts from the new arrangement.
- Fork
- Copies the system, nudges one body by 0.000001 and draws the copy as hollow rings. The fork gap shows how far apart the two futures drift.
- Speed and zoom
- Speed is logarithmic, from 0.1× to 10×. Zoom with the buttons, the mouse wheel, a two-finger pinch or the + and − keys. Fit returns to the default view.
- Fullscreen
- Keeps every control, including the custom scenario panel. Press Esc or the same button to leave.
- Custom scenario
- Enter x, y, vx and vy for each body and press Start. Presets fill the fields, so you can tweak any of them, and Copy current state loads what is on screen. With keep center of mass at rest ticked, the average position and velocity are subtracted first, so your numbers can shift; untick it to use them as typed. After Start, the message under the fields reports the total energy: negative means the system is bound, positive means expect bodies to fly apart.
- Readouts
- Time is in simulation units. Energy drift is the relative change in total energy since the start, a measure of numerical error rather than physics. Fork gap is the distance between body 1 in the two copies.
- Keyboard
- Space pauses, F toggles fullscreen, + and − zoom, 0 fits the view.
- Theme
- Black on white or white on black, following your device’s light or dark setting and switching live.
What you are looking at
Two bodies make an ellipse and stay there forever. Add a third and there is no general closed-form solution, so the motion can only be followed numerically, step by step. The default arrangement works because the scales are separated: a tight pair circles its own center while the third body circles that center from about six times farther away. Neither motion disturbs the other much, and many real triple stars are built this way.
The figure-eight, where all three masses chase each other along one curve, was found numerically by Cristopher Moore in 1993 and proved to exist by Chenciner and Montgomery in 2000. A 2013 catalog by Šuvakov and Dmitrašinović added many more periodic orbits, including the butterfly, moth, yin-yang and dragonfly. They are delicate: the starting values are rounded, so even these slowly leave their curve, and some unravel sooner than others.
The triangle fails faster. Equal masses on an equilateral triangle are an exact solution, but any tiny error grows until the formation tears itself apart. The same sensitivity is why a one-in-a-million fork can end up somewhere completely different.
The integrator is fourth-order Runge-Kutta with a time step that shrinks whenever two bodies get close.