N-Body System
Every pair of bodies pulls with Newton's law. PictorX integrates that acceleration each step in three dimensions, so you can watch a planet round its star, a moon, a binary star, a figure-eight, a 1:2:4 resonance, a gravity assist, an ejection, Trojan asteroids, or a cluster that merges and throws bodies out. Drag to turn the view. Drag to turn the view in 3D. Right-drag, Shift-drag, or drag with two fingers to pan, and scroll or pinch to zoom. Click a body to trace its orbit and read its eccentricity, inclination, and period. Double-click to fit the system. The readout tracks energy and angular momentum.
How it works
- Open this page. Two stars are already circling each other, and a planet goes round both, each with a glowing trail.
- Choose a favorite, or drag to turn the view in 3D and scroll to zoom. Click a body to read its eccentricity, inclination, and speed.
- Turn on velocity arrows or a gravity map, watch energy and angular momentum, then save a PNG.
The force between every pair
The acceleration of each body is G times a sum over every other body: mass, times the vector between them, divided by distance cubed. That is the only rule. Here G is 1 and the sun has mass 1000, so a Jupiter of mass 1 has about the real mass ratio. Circular speed at distance r from that sun is the square root of 1000/r, and the periods follow Kepler's third law.
Nested orbits, resonance, and Lagrange points
A planet and a moon is two circles at once: the moon orbits the planet, and that pair orbits the star. The resonance favorite places Io, Europa, and Ganymede on periods 1:2:4. Trojan asteroids sit near the equilateral points L4 and L5, sixty degrees ahead of and behind the giant planet, and stay there.
A slingshot, an ejection, and a cluster
A light probe that swings behind a moving giant can leave faster than it arrived. That is a gravity assist. In the ejection favorite a visitor falls into a binary and, after a chaotic dance, leaves on an escape path. The cluster drops a few dozen bodies into one well. Some merge. Some are thrown out. The trails draw the spirals.
Frequently asked questions
What equation is integrated each step?
The acceleration of body i is G times the sum over the other bodies of mⱼ (rⱼ − rᵢ) / |rⱼ − rᵢ|³. A small softening length keeps a direct collision from dividing by zero. The step is a velocity Verlet kick, drift, and kick.
Why do energy and angular momentum barely change?
Gravity inside the system is a conservative central force, so both are conserved. The readout is the drift from the value at the start. A merger is inelastic, so the cluster's energy changes when two bodies combine.
What is a gravity assist?
In the giant planet's frame the probe's speed is about the same on the way in and the way out, but the direction changes. Back in the sun's frame that turn can add speed. The slingshot favorite uses a heavier giant than the real Jupiter so the bend is easy to see.
Can I turn the view?
Yes. Drag the picture to turn it in 3D, or choose Angled, From above, or Edge-on under View. Right-drag, Shift-drag, or drag with two fingers to pan. With the picture focused, the arrow keys turn it too.
Does this upload anything?
No. The simulation runs on a canvas in your browser. Save downloads a PNG. 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.
Go to Editor