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₁ m₂ / r², with G = 6.67430 × 10⁻¹¹ 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ⱼ (rⱼ − rᵢ) / |rⱼ − rᵢ|³. A small softening length is added under the square root so a direct hit does not divide by zero.
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.
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ₓ). 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.
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.
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.
Does PictorX upload the simulation?
No. It runs on a canvas in your browser. Save downloads a PNG, and Edit opens that image in the PictorX editor.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Try N-Body System