PHYSICS LAB
Home›Classical Mechanics›N-Body Gravitational Simulator

CLASSICAL MECHANICS · SIMULATION 10

N-Body Gravitational Simulator

Create planetary systems, binary stars and galaxies, then watch every body reshape every other orbit.

GRAVITATIONAL FIELD · DIRECT SOLVERLEAPFROG ACTIVE
Active bodies0
Total energy0.000
Energy drift0.000%
Angular momentum0.000
CONSERVATION MONITORkinetic · potential · total energy
KineticPotential magnitudeTotal

THE PHYSICS

Every body pulls on every other.

Two-body motion has exact conic-section solutions. Add a third body and the shared gravitational feedback can become exquisitely sensitive, producing resonances, close encounters, ejections and chaos.

ai = G Σ mj(rj−ri) / (r²+ε²)3/2softened pairwise gravitational acceleration
Leapfrog integration

The default kick–drift–kick method is symplectic, making it better suited than simple Euler integration to long orbital experiments.

Close encounters

Softening prevents singular acceleration at zero separation. Collision merging conserves mass and linear momentum but simplifies real astrophysics.

Galaxy models

The galaxy presets are educational particle models. Real simulations include dark matter, gas, star formation and vastly more particles.