Kepler Equation Simulator Back
Celestial Mechanics Simulator

Kepler Equation Simulator — Numerical Solution of Elliptic Orbits

Solve the transcendental equation M = E - e*sin(E) by Newton iteration in real time and read off the eccentric anomaly, true anomaly, focal distance, and orbital period. The orbit shape and quadratic convergence are shown directly.

Parameters
Semi-major axis a
AU
Eccentricity e
Mean anomaly M
deg
Central mass M_central
M_sun

Convergence tolerance 1e-10, max 30 iterations. Newton iteration is quadratically convergent and usually reaches 10-digit accuracy in 3 to 5 steps.

Results
Eccentric anomaly E
True anomaly v
Focal distance r
Orbital period T
Elliptical orbit and satellite position

Blue ellipse = orbit / Yellow disk = central body (focus) / White disk = satellite / Green line = focal distance r / Gray dashed = point on the auxiliary circle for E.

Newton iteration convergence history

X = iteration n / Y = residual log10|f(E_n)|. Quadratic convergence almost doubles the digit count per step (tolerance line at 1e-10).

Theory & Key Formulas

Kepler's equation gives the position of a body on an elliptical orbit as a function of time. The mean anomaly M is proportional to time, but it relates to the geometric eccentric anomaly E through a transcendental equation, so a numerical solution is required.

Kepler's equation and Newton iteration:

$$M = E - e\,\sin E,\qquad E_{n+1} = E_n - \frac{E_n - e\,\sin E_n - M}{1 - e\,\cos E_n}$$

True anomaly v and focal distance r:

$$\tan\!\frac{\nu}{2} = \sqrt{\frac{1+e}{1-e}}\,\tan\!\frac{E}{2},\qquad r = a\,(1 - e\,\cos E)$$

Orbital period from Kepler's third law (in solar-mass units):

$$T = 2\pi\sqrt{\frac{a^{3}}{G\,M_{c}}}\;\;\Longrightarrow\;\; T_{\mathrm{yr}} = \sqrt{\frac{a_{\mathrm{AU}}^{3}}{M_{c,\odot}}}$$

Here $a$ is the semi-major axis [AU], $e$ the eccentricity (0 to 1), $M$ the mean anomaly [rad], $E$ the eccentric anomaly [rad], $\nu$ the true anomaly [rad], $M_c$ the central mass [solar mass], and $T$ the orbital period [yr].

What is the Kepler Equation Simulator?

🙋
I learned that planets move on elliptical orbits — is there some formula where you plug in time and get the position back?
🎓
Almost — the surprising part is that there is no closed-form solution. Define the mean anomaly M as the angle proportional to time. It is connected to the eccentric anomaly E by Kepler's equation $M = E - e\sin E$, which is transcendental and cannot be solved for E in elementary functions. So you have to do it numerically with Newton iteration. That is exactly what this simulator does.
🙋
Wait — even the position of a planet has no analytical formula?
🎓
Right. It always surprises beginners, but Kepler's equation is the textbook example of a transcendental equation and still opens most numerical-methods chapters today. With the defaults e=0.20, M=60 deg, starting from E_0 = 60 deg the Newton iteration converges quadratically to E_1 ~ 71.03 deg, E_2 ~ 70.823 deg, reaching 10-digit accuracy in three steps. Watch the residual plot drop sharply.
🙋
What if I crank the eccentricity up to 0.9?
🎓
Good question. With e ~ 0.9 the orbit becomes very elongated, and especially when M is near pi the initial guess E_0 = M is poor and Newton needs more iterations. For a Halley-comet-class orbit (e=0.967) you may need a smarter starter (e.g., Battin's). To stay safe this tool uses tol = 1e-10 and at most 30 iterations, which still converges at e = 0.95. Slide e while watching the convergence chart and you can directly see when quadratic convergence kicks in.
🙋
How does the true anomaly v on the right differ from E?
🎓
Great question. E is the geometric angle measured from the ellipse center, while v is the actual observed angle measured from the focus (the Sun). With the defaults e=0.20, M=60 deg, you get E=70.82 deg and v=82.10 deg — slightly different. For a circular orbit (e=0) all three of M, E, v coincide; for an ellipse the difference between them is essentially the orbit's identity. To convert position into observables, use v.
🙋
The orbital period is from Kepler's third law, right?
🎓
Yes — $T^2 \propto a^3$. In solar-mass and AU units it simplifies to $T_{\mathrm{yr}} = \sqrt{a^3/M_c}$. Earth (a=1, M_c=1) gives T=1 year; Halley (a=17.8) gives T ~ 75 years. This simulator also lets you change the central mass, so you can immediately see how planets around a white dwarf (0.6 M_sun) or a giant (10 M_sun) would have very different periods.

Frequently Asked Questions

When the eccentricity e is small, Kepler's equation M = E - e*sin(E) is close to M ~ E, so E_0 = M is a good starting point. Newton's method converges quadratically, so an error of ε at one step shrinks to O(ε^2) after one iteration and to O(ε^4) after two. For e = 0.2 the starting error is about 0.18 rad, but it shrinks to 1e-4 rad after two iterations and 1e-10 rad after three. For e > 0.6 or M near pi the initial guess is worse, and you can clearly see the iteration count grow in the convergence chart.
That is the heart of Kepler's first law: planets move on ellipses with the Sun at one of the foci. From Newtonian mechanics, the two-body problem under an inverse-square central force gives conic-section orbits (ellipses, parabolas, hyperbolas), and the attractor sits exactly at the focus. Geometrically, the focal distance r varies with position around the orbit, so the planet moves fast near perihelion and slow near aphelion (Kepler's second law, equal areas in equal times). If you sweep M from 0 to 360 deg you can see the satellite speed up near perihelion and slow near aphelion.
Not as is. For e >= 1 the orbit is open and the period diverges, so a different "hyperbolic" or "parabolic" Kepler equation is required (Barker's equation, etc.). Comets passing through the solar system on parabolic or hyperbolic orbits are handled with $M_h = e\sinh F - F$ (hyperbolic) or $D + D^3/3 = 2 M_p$ (Barker, parabolic). To stay safe this simulator caps e at 0.95 and only treats the elliptic case.
Yes — GPS receivers solve Kepler's equation in real time. GPS satellites move on nearly circular orbits about 26,600 km in radius with eccentricity around 0.01, and each satellite broadcasts its orbital elements (semi-major axis, eccentricity, argument of perigee, longitude of ascending node, inclination, time of perigee). The receiver computes M from the current time, solves Kepler's equation by Newton's method to get E, derives the satellite position, and triangulates from several satellites. Because e is small, two or three iterations are usually enough.

Real-World Applications

Satellite mission planning and operations: Kepler's equation is at the heart of every artificial satellite, space station, and space-telescope orbit prediction. NASA's SGP4/SDP4 and ESA's Orekit propagation libraries iterate Kepler's equation to predict future positions from initial orbital elements. Mars rover operations, lunar and asteroid landing sequences, and orbital debris collision forecasts all run the same calculation that this simulator demonstrates.

Exoplanet detection and characterization: Transit and radial-velocity data analyses fit observed brightness or velocity variations to a Kepler-orbit model, recovering planetary parameters such as mass, eccentricity, and orbital period. Most of the 2,000+ exoplanets discovered by the Kepler Space Telescope (named, fittingly, after the same Kepler) were characterized by repeatedly solving this equation inside MCMC or least-squares fitters.

GPS and GNSS positioning: Every GNSS — GPS, Galileo, BeiDou, and GLONASS — has the receiver compute satellite positions in real time by solving Kepler's equation from the broadcast ephemeris. Your phone does this every second; the calculation is small, but its accuracy is the basis of meter-level positioning.

Asteroid and comet orbit determination: Asteroid sample-return missions like Hayabusa2 and OSIRIS-REx fit target-orbit elements to ground-based observations by least squares and then propagate them with Kepler's equation. The Near-Earth Object monitoring networks use the same framework to keep computing potentially hazardous asteroid orbits decades into the future.

Common Misconceptions and Pitfalls

The most common misconception is that "the mean anomaly M and the eccentric anomaly E are the same angle." They coincide only for a circular orbit (e = 0); for an ellipse they differ in general. M is a fictitious angle that grows linearly with time and equals the position angle only for a circular orbit; for an ellipse M is just a parameterization of time. The actual geometric position is given by E, and the angle as seen from the Sun is given by v. With M = 60 deg the simulator returns E = 70.82 deg, meaning that 60/360 = 1/6 of the period after perihelion the satellite is at "70.82 deg seen from the center, 82.10 deg seen from the Sun."

The next is to assume that "Newton's method always converges fast." The elliptic Kepler equation has f'(E) = 1 - e*cos(E) > 0, so Newton converges monotonically; but for e close to 1 with M near pi the starting point E_0 = M is poor, and several iterations may be needed before quadratic convergence sets in. This tool caps the iteration at 30; serious orbit-determination codes use Halley (cubic convergence) or Laguerre solvers. Try e = 0.95, M = 170 deg in the slider and watch the iteration count grow.

Finally, beware of overstating Kepler's equation as the "essence of an elliptical orbit." It is exact only for the pure two-body problem (Sun + one planet). The real solar system has small but ever-present perturbations from other planets and relativistic corrections (Mercury's perihelion precession is the classic example). GPS and deep-space probes treat the Kepler orbit as a baseline and add perturbations via Cowell's or Encke's methods. Use this simulator as the starting point for "pure Kepler" intuition, not as a complete orbit model.