Expand description
Gravitational N-body simulation by velocity-Verlet (symplectic), 2D.
Pairwise softened gravity a_i = G·Σ_{j≠i} m_j (r_j−r_i)/(|r_j−r_i|²+ε²)^{3/2}.
Validation: a symplectic integrator conserves total energy
E = ½Σm|v|² − ½ΣΣ G m_i m_j /√(|r_i−r_j|²+ε²). The test runs a small
cluster and asserts the energy drift stays well under 1%.
Functions§
- solve
- Solves.