Many masses, each pulling on all the others. There is no closed-form answer for three or more — but the law is exact, and it is runnable: sum the inverse-square force over every pair, step time forward with a symplectic map, and two things never move — total momentum (locked by Newton's third law) and total energy (bounded, no drift). Down the center, state flows: masses go in, the engine integrates, the conserved quantities come out. The blue team builds and defends it; the red team tries to break it.
source Newton, Philosophiæ Naturalis Principia Mathematica (1687) — the gravitational N-body problem. Motte tr. — archive.org/details/newtonspmathema00newtrich. No stable 1687 first-edition link, so AMBER. Rendered, not quoted.
Between every pair of bodies, one law:
F = G·mi·mj / r² , directed along the line between them, attractive. The acceleration on body i is the sum over all others — an O(n²) pairwise total.
Time advances by a symplectic velocity-Verlet map (half-kick, drift, half-kick). It is not exact, but it conserves a shadow energy, so the true energy oscillates within a bound instead of drifting — the hallmark that separates a symplectic integrator from a naïve Euler step.
Live invariants of the running system (drift from the initial value):
| quantity | conserved to |
|---|
Gravity among many is the N-body problem: pairwise inverse-square forces, energy and momentum conserved, the middle term of every pair vanishing into the total.
The cost is the n(n-1)/2 pair sum — quadratic, brutal at scale. That exact sum is what the-barnes-hut approximates with a tree: group distant masses into one, drop the cost to O(n log n), and trade a controlled error for reach. This sphere is the ground truth its neighbour approximates.
The blue team's live check: integrate a known system afresh and confirm total momentum holds to floating-point (<1e-11) and energy stays bounded. If red breaks the third law, momentum drifts and this badge goes red.
A system is a list of bodies, each with a mass and a state (x, y, vx, vy). Nothing else is fed in — the whole future is implied by the law and these numbers.
| system | bodies | pairs O(n²) |
|---|---|---|
| figure-8 choreography | 3 | 3 |
| Kepler binary | 2 | 1 |
| 5-body cluster (seeded) | 5 | 10 |
Every system is placed in the centre-of-mass frame (total momentum set to zero), so a drifting total momentum can only mean the machine is broken. That zero is the feedstock the panel below integrates.
The forces are summed live over every pair each step; the invariants are measured, never asserted into place. Break the third law in window 6 and watch the total momentum walk off zero.
What the machine proves, live: total momentum conserved to floating-point (the pairwise forces cancel by Fij = −Fji), total energy bounded by the symplectic map, angular momentum conserved for the central force, and a two-body orbit that closes into a Kepler ellipse after one period.
The blue team's witness (left) re-derives these from scratch; the red team (right) tries to make momentum lie.
Symplectic conservation is a property of the map, not a guarantee of truth: the shadow energy it preserves is not the real Hamiltonian, and over exponential time chaotic orbits diverge from the true trajectory regardless. What is exact here is momentum — a symmetry, not an approximation.
"A symplectic integrator conserves energy exactly." Cut. It conserves a nearby shadow Hamiltonian; the true energy oscillates within a bound — here to ~1e-7, never zero.
"The three-body problem has no solution." Cut. Sundman (1912) gave a convergent series; it is just uselessly slow. "No solution" should read "no solution in elementary closed form."
"Energy conservation is the strong check." Kept, corrected. The strongest check is momentum — it is conserved to 1e-14 by the third law alone, independent of step size, which is exactly why breaking that law is detectable.
The red team's move: break Newton's third law — apply each pair's force to only one body, so Fij ≠ −Fji. The forces no longer cancel; total momentum walks off zero. The blue team's witness (window 7) is watching.
Break the third law and the summed force is no longer zero — momentum drifts, the running system self-accelerates, and the witness recomputes, disagrees, and turns red. Nothing is faked; the attack is real and it is caught.