Binary Star Orbit — 2D Kepler plot

Switch to 3D
Controls
Live readouts
Numerical checks
What to try
  1. Pick "Equal twins": both stars trace the same circle around the barycentre; their radial velocities are exactly opposite.
  2. Raise the mass of star B and watch the barycentre move away from star A: a1 / a2 = m2 / m1.
  3. Select "Highly eccentric": the stars whip past each other at periapsis and the radial-velocity curves become sharply peaked.
  4. Switch the frame to "star A at rest" to see the relative orbit that astronomers fit with a single ellipse.
  5. Lower the inclination toward 5 degrees: the orbit is unchanged but the radial-velocity amplitude (and so the measured mass function) collapses.
The science

Two point masses m1, m2 attract each other with Newton's law. The problem reduces to one body of reduced mass moving in the field of the total mass M = m1+m2; both stars orbit their common barycentre.

r₁ = −(m₂/M) r,  r₂ = (m₁/M) r,  r = r₂ − r₁ d²r/dt² = −G M r / |r|³ T² = a³ / M  (T in years, a in AU, M in solar masses; G = 4π²) K₁ = (2πG/T)^(1/3) m₂ sin i / (M^(2/3) √(1−e²))

The page integrates the relative orbit with the symplectic velocity-Verlet scheme (6000 steps per orbit on screen, 40,000 in the checks). The three checks compare the measured period with Kepler's third law, verify energy conservation, and compare the integrated radial-velocity semi-amplitude with the closed-form K1.

Simplifications: point masses (no tides, mass transfer or relativity), the orbit plane is fixed, and the real stars' orbits are only drawn in the plane; inclination affects only the radial-velocity readout. Real system parameters are rounded literature values.