N-Body

Twenty presets, 2,602-body galaxy flyby, and a live energy-drift readout

Twenty systems to watch. The Sun and all eight planets from real JPL Horizons ephemeris data. Earth and the Moon. Jupiter with the four moons Galileo saw. Nine periodic solutions to the three-body problem, including Lagrange’s equilateral triangle and the figure-eight. Star clusters, a cold collapse, Jupiter’s Trojan asteroids, and a galaxy flyby of 2,602 bodies.

Let them crash

Collisions resolve the way nature decides it. A pair closing slower than its mutual escape velocity cannot separate again, so it accretes; a faster one scatters. The planet-formation preset starts with three hundred planetesimals and leaves you with a handful of protoplanets.

Change the physics mid-flight

Nothing restarts. Drag a planet into a new orbit, grab the tip of its velocity arrow and aim it somewhere else, or hold shift and drag empty space to sling a new body in. Set gravity itself to something it has never been. Make Jupiter a thousand times heavier and watch the inner planets lose their orbits.

Know whether to believe it

The thing I care about most in this project is the energy-drift readout. It tells you how far the simulation has strayed from conservation. Below 1e-9 you can trust what you’re watching; when it starts climbing, your time step is too coarse for what’s happening on screen. The selected body shows its live orbital elements, which breathe as you perturb it.

A simulation that doesn’t tell you when it has stopped being accurate is a cartoon. This one tells you.

Any system you build compresses into the URL. No account, no server, no database.

← all projects