AI authored to showcase ironpad capabilities.
The N-body problem asks: given N massive bodies interacting through gravity, how do they move over time?
Newton's law of gravitation gives the force between two bodies:
F = \frac{G \, m_1 \, m_2}{r^2}
For N bodies, each feels the combined gravitational pull of every other body — requiring \binom{N}{2} = N(N\!-\!1)/2 force pair calculations per timestep.
We simulate a central star (mass = 200) with four orbiting planets using Velocity Verlet integration — a symplectic integrator that conserves energy far better than naive Euler methods. A softening parameter \varepsilon prevents numerical singularities at close approach.
Run the cells below to see orbital mechanics emerge from simple force laws!
Each colored trail traces a planet's orbit around the central star. The inner planets complete more orbits because they move faster (Kepler's third law: T^2 \propto r^3).
Unlike naive Euler integration (which systematically gains or loses energy), Velocity Verlet is symplectic — it preserves the geometric structure of the phase space. This means:
While our 5-body system appears stable, N-body systems are fundamentally chaotic — tiny perturbations in initial positions grow exponentially over time. This is why long-term weather prediction is impossible and why predicting the solar system beyond ~100 million years requires extreme precision.
"The three-body problem is one of the most famous unsolved problems in mathematical physics."
Try modifying the initial conditions or adding more bodies to see how the dynamics change!