Inputs
Formula used
Each body experiences the vector acceleration:
aᵢ = Σⱼ≠ᵢ G mⱼ (rⱼ − rᵢ) / (|rⱼ − rᵢ|² + ε²)^{3/2}
- ε is the softening length to prevent singular forces.
- Total energy E = K + U with K = Σ ½ mᵢ|vᵢ|².
- Potential U = −Σ_{i<j} G mᵢ mⱼ / √(|rᵢ−rⱼ|²+ε²).
- Momentum P = Σ mᵢ vᵢ, angular momentum L = Σ rᵢ × (mᵢ vᵢ).
How to use this calculator
- Choose consistent units for G, mass, distance, and time.
- Pick an integrator: Leapfrog for long runs, RK4 for precision.
- Set dt small enough to resolve the fastest orbit.
- Use ε to stabilize near-collisions and tight passes.
- Enter bodies, then press Simulate to view results above.
- Download CSV for full trajectories, PDF for compact summaries.
Example data table
You can load these values instantly using “Load example”.
| # | m | x | y | z | vx | vy | vz |
|---|---|---|---|---|---|---|---|
| 0 | 1 | -0.97000436 | 0.24308753 | 0 | 0.466203685 | 0.43236573 | 0 |
| 1 | 1 | 0.97000436 | -0.24308753 | 0 | 0.466203685 | 0.43236573 | 0 |
| 2 | 1 | 0 | 0 | 0 | -0.93240737 | -0.86473146 | 0 |
Note: This simulator uses an O(N²) force loop. For large-N astrophysical runs, consider Barnes–Hut or fast multipole methods.