Astronomy and Space Exploration ES

Simulators / N bodies: integrators and chaos

N bodies: integrators and chaos

SecondaryHigher

RK4 versus symplectic leapfrog on an eccentric two-body orbit, the figure-eight and the Pythagorean problem; energy error on a log scale and divergence of neighboring trajectories (Lyapunov).

r¨i=∑j≠iGmj(rj−ri)∣rj−ri∣3,H~=H+O(h2),λ=lim⁡t→∞1tln⁡δ(t)δ0\ddot{\mathbf r}_i = \sum_{j\ne i} \frac{G m_j(\mathbf r_j-\mathbf r_i)}{|\mathbf r_j-\mathbf r_i|^3},\quad \tilde H = H + O(h^2),\quad \lambda = \lim_{t\to\infty}\tfrac1t\ln\tfrac{\delta(t)}{\delta_0}
three equal masses, T ≈ 6.3259 · t = 0.00

Library: src/lib/math/nbody.tssrc/lib/math/integrators.ts