4
0.002
800

More information about N-body systems

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

  1. Open this page. Two stars are already circling each other, and a planet goes round both, each with a glowing trail.
  2. 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.
  3. 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. TRAPPIST-1 is a real red dwarf whose seven Earth-sized planets run in a chain of near-resonances. In the Lagrange triangle three equal masses keep the corners of an equilateral triangle while it turns, shrinks and swells, until it breaks apart. The Klemperer rosette is a ring of heavy and light bodies in turn that spins as one, until it too comes apart.

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. The moth is another repeating dance of three equal masses, found in 2013. In the Sitnikov problem a planet falls back and forth through the middle of two stars. In colliding galaxies, the tides pull two disks of stars out into long tails. The Pythagorean problem lets three bodies of masses 3, 4 and 5 fall from rest; after a long dance of near misses the lightest is flung out and the other two leave as a pair. The open star cluster holds 300 stars, most of them small and red and a few heavy and blue; the heavy ones sink to the middle and the light ones drift out. In the Whirlpool Galaxy a passing companion raises two spiral arms in a disk of stars. In the dwarf galaxy stream the Milky Way's tide pulls a small galaxy out into long streams of stars along its orbit.

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