Celestial Rhapsody

Celestial Rhapsody simulates a set of bodies moving under their mutual Newtonian gravity and turns the result into an animation. The whole system is described in a small input file, so no programming is needed.

Three bodies on a periodic orbit

All it takes is one command:

nbody run my_system.json

which writes my_system.gif.

What it does

For each body \(i\) the code computes the acceleration

\[\ddot{\mathbf r}_i = -G \sum_{k \neq i} m_k \frac{\mathbf r_i - \mathbf r_k}{|\mathbf r_i - \mathbf r_k|^3}\]

and advances positions and velocities with a 4th-order Runge-Kutta scheme (Euler and RK2 are also available). See Physics and numerical methods for details.

Indices and tables