Orbits and Kepler's laws simulator

Stretch an orbit, change the central mass and see equal areas swept out in equal times.

Equal areas in equal times An elliptical orbit with eccentricity 0.5, divided into twelve wedges that the planet sweeps out in equal times. Wedges near the star are short and wide; far from the star they are long and thin, but all have the same area. perihelion aphelion star (focus)
Eccentricity 0.5. The dots are the planet's positions at twelve equal time steps; every shaded wedge has the same area (Kepler's second law).

What’s happening

Kepler’s three laws describe how planets move:

  1. Orbits are ellipses with the star at one focus. The shape is set by the eccentricity ee: the closest distance is rp=a(1−e)r_p = a(1-e) and the farthest is ra=a(1+e)r_a = a(1+e).
  2. A planet sweeps out equal areas in equal times, so it moves fastest near the star.
  3. The period depends only on the semi-major axis and the central mass. In units of years, AU and solar masses: P=a3/MP = \sqrt{a^3/M}.

To find where a planet is at a given time, solve Kepler’s equation for the eccentric anomaly EE:

M=E−esin⁡E,M = E - e\sin E,

where the mean anomaly M=2πt/PM = 2\pi t/P grows uniformly with time. There is no closed-form solution, but Newton’s method converges quickly from the starting guess E0=M+esin⁡ME_0 = M + e\sin M. Then r=a(1−ecos⁡E)r = a(1 - e\cos E), and the speed follows from the vis-viva equation:

v2=GM(2r−1a).v^2 = GM\left(\frac{2}{r} - \frac{1}{a}\right).

Assumptions and limits. Two bodies only, with the planet’s mass negligible compared with the star’s. Other planets cause small perturbations that this model ignores.

Try this

  1. Mars. Mars orbits the Sun at a=1.524a = 1.524 AU. What is its period?
    AnswerP=1.5243/2≈1.88P = 1.524^{3/2} \approx 1.88 years.
  2. Earth’s speed. Earth has a=1a = 1 AU and e=0.0167e = 0.0167. Find its speed at perihelion and aphelion.
    Answerrp=0.9833r_p = 0.9833 AU gives vp≈30.3v_p \approx 30.3 km/s; ra=1.0167r_a = 1.0167 AU gives va≈29.3v_a \approx 29.3 km/s.
  3. Solve Kepler’s equation. For e=0.5e = 0.5 and M=1M = 1 rad, find EE and r/ar/a.
    AnswerE≈1.4987E \approx 1.4987 rad, so r/a=1−0.5cos⁡E≈0.964r/a = 1 - 0.5\cos E \approx 0.964. The true anomaly is about 116.4°116.4°.
  4. Heavier star. A planet orbits a 4 M⊙4\,M_\odot star at 1 AU. How long is its year?
    AnswerP=1/4=0.5P = \sqrt{1/4} = 0.5 years.

Want help with this topic?

A 30-minute trial costs €10. We set goals and you see how I teach. After that, lessons are €30 for 60 minutes, or less with a pack.