Gravity between many bodies
An n-body system is a set of masses that attract one another and nothing else. Two bodies make Kepler's ellipses. Add a third and the motion can resonate, librate, slingshot, or become chaotic. PictorX draws that motion in 3D as it happens.
Newton's law, in the form the app uses
The force between two masses is \(F = G m_{1} m_{2} / r^{2}\), with \(G = 6.67430 \times 10^{-11}\) in SI units. The picture is easier to read with \(G = 1\) and relative masses, which does not change the shape of the orbits. Each step the app computes the acceleration of body i as G times the sum over every other body j of \(m_{j} (r_{j} - r_{i}) / \lvert r_{j} - r_{i} \rvert^{3}\). A small softening length is added under the square root so a direct hit does not divide by zero. The Pythagorean problem's passes are too close for fixed steps, which would lose the energy at the first one, so that favorite has no softening length and moves the bodies with Dormand and Prince's Runge–Kutta method instead, shrinking each step until its error is below a millionth of a millionth; its energy then holds to a few parts in a billion. The Lagrange triangle and the Klemperer rosette are moved the same way, so what breaks them is their own instability, not the error of the steps.
What the favorites are showing
Two-body is one circular orbit, the setup behind Kepler's laws. Planet and moon nests a small orbit inside a large one. The planet is heavier than the real Jupiter so the moon's loop stays visible. Binary stars orbit a shared center of mass, and a planet orbits both. Figure-eight is the periodic dance of three equal masses. Resonance places three moons on periods 1 : 2 : 4, the Laplace resonance of Io, Europa, and Ganymede. Trojans sit near the equilateral points L4 and L5. Slingshot is a gravity assist. Ejection starts with a visitor that is still bound to a binary and ends with that visitor leaving. The cluster is gravity alone: bodies merge on contact and some are thrown out. Moth is a periodic orbit of three equal masses that Šuvakov and Dmitrašinović found in 2013; it repeats every 14.9 time units but is unstable, so in time it comes apart. TRAPPIST-1 has the real system's seven planets at their measured distances and masses, spread out to fill the view, so their periods keep their real ratios. In the Sitnikov problem a planet sits on the line through the middle of two equal stars on an eccentric orbit and falls back and forth through them; its swings can be as irregular as a coin toss. Colliding galaxies follows Alar and Juri Toomre's model of 1972: two heavy cores, each ringed by stars too light to pull on anything, swing past each other, and the tides draw out a bridge and long tails. The Pythagorean problem, which Burrau posed in 1913, starts masses 3, 4 and 5 at rest on the corners of a 3-4-5 right triangle; they pass within four ten-thousandths of each other, and after about 60 time units the lightest is thrown out while the other two leave as a pair, as Szebehely and Peters found in 1967. The Lagrange triangle is the solution Lagrange found in 1772: three equal masses on the corners of an equilateral triangle, each on an ellipse around their middle, so the triangle turns, shrinks and swells but keeps its shape. For equal masses it is unstable, as Routh showed in 1875, and after about six turns it breaks up. The Klemperer rosette, which Klemperer described in 1962, puts four heavy and four light bodies in turn around a ring, the light ones a little farther out, so the whole star turns as one; it is unstable too and comes apart after about five turns. The open star cluster has 300 stars in a Plummer sphere, with masses from Kroupa's mass function, from a tenth of the sun's to eight suns. Close passes trade energy, so the heavy stars sink to the middle, the light ones drift out, and now and then one leaves for good. The Whirlpool Galaxy follows the Toomre brothers' model of M51: its companion, NGC 5195, a third of its mass, swings past just outside the disk, and the tide raises two long spiral arms and a bridge toward it. In the dwarf galaxy stream a small galaxy on an eccentric orbit around the Milky Way, like the Sagittarius dwarf, loses its outer stars to the tide at each close pass. They run on ahead and fall behind along its orbit: about a third of its stars by the second pass and half by the fourth.
Energy, angular momentum, and eccentricity
Total energy is kinetic energy plus gravitational potential. The potential is negative, and for a bound system the total is negative too. The readout shows the angular momentum around the axis square to the plane of the orbits: the sum of mass times (x vᵧ \(- y v_{x}\)). Both stay nearly constant because the force is conservative and points along the line between each pair. Click a body to draw its orbit and read its eccentricity around what it orbits: the body that pulls it hardest, taken together with any close partner, such as the other star of a binary. Near 0 is a circle, between 0 and 1 an ellipse, and above 1 an escape. When bodies in the cluster merge, the energy the collision turns to heat is left out of the drift, so drift still measures only the error of the steps.
Orbits in three dimensions
The bodies move in three dimensions, not on a flat sheet. In the planet and moon favorite the moon's orbit is tilted 5.1° to the planet's, like the real Moon's, and the cluster starts as a thick disk, so its bodies move above and below the middle plane. The inclination i in the readout is the tilt of the orbit of the body you click. Drag the picture to turn it, or choose Edge-on under View to see the orbits from the side. In the Sitnikov problem the planet moves only up and down, square to the stars' orbit, and in colliding galaxies one disk is tilted 60° to the other. The open star cluster is a ball, not a disk, and its stars move in every direction. In the Whirlpool Galaxy the companion's orbit is tilted 25° to the disk, and in the dwarf galaxy stream each of the dwarf's stars circles its core in a plane of its own.
Frequently asked questions
Why do some bodies fly off the screen?
The camera follows bodies that are still inside the system. An ejected body keeps its trail and leaves the frame. Double-click the view to fit the system again, or scroll to zoom out.
Can I trust the energy number?
On a smooth orbit the drift stays near zero. A close pass, a large time step, or a merger moves it. Shrink the time step if a favorite starts to look ragged.
Is there an exact solution for three bodies?
Not in general. Two bodies follow Kepler's ellipses, but for three or more there is no formula for every case, so the motion is worked out step by step, as the app does. A few special solutions exist, such as Lagrange's equilateral triangle, behind the Trojans, and the figure-eight that Chenciner and Montgomery proved in 2000.
Why do the Trojans stay near L4 and L5?
L4 and L5 lie 60° ahead of and behind the smaller body on its orbit, each forming an equilateral triangle with the two large masses. There the pulls of both masses and the orbital motion balance, and the points are stable when the larger mass is more than about 25 times the smaller. In the Trojans favorite the Sun is 1,000 times Jupiter, so bodies near L4 and L5 librate around them instead of drifting away.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Try N-Body System