Perihelion precession in a Schwarzschild-like potential
What you are seeing: a planet on an elliptic orbit around a massive central body. In pure Newtonian gravity the ellipse is closed: the point of closest approach (perihelion) stays exactly in place. General relativity adds a small correction that breaks this closure. Each orbit rotates the entire ellipse by a tiny angle. For Mercury the real value is about 43 arcseconds per century, way too slow to render; here you can dial the GR strength up so it is visible within a handful of orbits.
The acceleration is , with and semi-major axis in code units. The first term is Newton; the second is the orbit-averaged 1PN correction from the Schwarzschild metric. The orange ellipse is the current orbit; faint blue traces are the four most recent orbits, showing the precession. Red dots are perihelion passages.
shared/js/engine/symplectic.js, fixed dt = 0.005.WHAT TO TRY
- Vary each control and watch the rail readouts respond.
- Compare the diagnostic plot against the live scene.