HomeCompanion pagesRelativistic 2-Body Gravity

Relativistic 2-Body Gravity

A 2-body gravitational system with relativistic adjustments and time-delayed (retarded) interactions. Gravity propagates at finite speed c, breaking Newton's third law and producing orbital precession, frame-dragging analogues, and chaotic orbits.

Open the interactive lab Watch the video

Relativistic 2-Body Gravity Simulator

Overview

A 2D slice of 3D space that simulates a 2-body gravitational system with relativistic adjustments and time-delayed (retarded) interactions. The goal is to demonstrate phenomena like orbital precession, frame dragging analogues, and exotic/chaotic orbits that do not appear in naive Newtonian models.

Users can manipulate the masses, initial positions/velocities, and the strength of relativistic effects to watch the system evolve. This is intended as a visually engaging, interactive way to explore concepts spanning classical mechanics and general relativity.

Core Physical Concepts

1. Newtonian Baseline

We start from the standard inverse-square law:

F = G * m1 * m2 / r^2

applied along the line connecting the two bodies. This gives us a known-good reference (closed elliptical orbits) to validate against before layering on complexity.

2. Time-Delayed (Retarded) Interactions

In reality, gravitational influence propagates at finite speed c. Body A does not feel where body B is, but where body B was at the retarded time:

t_ret = t - |r_A(t) - r_B(t_ret)| / c

This is an implicit equation (the delay depends on the distance, which depends on the delayed position) and must be solved iteratively per step.

Consequence: Forces are no longer symmetric (Newton's third law is broken for the instantaneous pair). Momentum is carried by the field. Therefore we cannot naively center the simulation on the center of mass or on a single body. We must track full position/velocity histories for both bodies and interpolate to evaluate forces at arbitrary past times.

3. Relativistic Corrections

We introduce a tunable "relativity strength" parameter alpha in [0, 1] that blends from pure Newtonian (alpha = 0) to fully-corrected (alpha = 1). Planned correction terms:

The precession of Mercury (~43 arcsec/century from GR) is the canonical target behavior we want to reproduce qualitatively.

Architecture

experiments/gravity/
README.md
index.html          # canvas + control panel mount point
src/
  main.js           # entry point, animation loop, wiring
  simulation.js     # core integrator + force model
  body.js           # Body class: state + history ring buffer
  history.js        # StateHistory: storage + interpolation
  physics.js        # force models (newtonian, retarded, relativistic)
  vector.js         # small 2D vector math helpers
  renderer.js       # canvas drawing (bodies, trails, vectors)
  controls.js       # UI sliders/inputs -> simulation params
  presets.js        # named initial conditions (binary, precessing, chaotic)
styles/
  main.css
test/
  vector.test.js
  history.test.js
  physics.test.js
  simulation.test.js

Key Data Structures

Numerical Methods

  1. Guess t_ret = t (zero delay).
  2. Compute distance to interpolated past position.
  3. Update t_ret = t - dist / c.
  4. Repeat until convergence (typically 3-5 iterations).

Implementation Phases

Phase 0 — Scaffolding

Phase 1 — Newtonian Baseline

Phase 2 — History & Interpolation

Phase 3 — Retarded Interactions

Phase 4 — Relativistic Corrections

Phase 5 — Interactivity & Presets

Phase 6 — Polish

User Controls (planned)

Control Range / Type Effect
Mass 1 / Mass 2 slider Body masses (scales gravity)
Initial velocity drag vector Sets each body's starting velocity
c (light speed) slider Strength of retardation (lower = more)
alpha (rel.) slider [0,1] Blend Newtonian <-> relativistic
G slider Overall coupling strength
dt slider Integration step (accuracy vs. speed)
softening eps slider Avoid close-approach singularities
Play / Pause / Step buttons Timeline control
Reset / Preset buttons / menu Load initial conditions

Validation & Testing Strategy

Open Questions / Future Ideas

Non-Goals