Kepler's Equation for Elliptical Motion, a Numerical Solution Utility


This page contains a routine that numerically solves Kepler's Equation for Elliptical Motion.


Shampine, L. F. (SNLA) and H. A. Watts (SNLA)
          "FZERO, A Root-solving Code"   Report SC-TM-70-631
          Sandia Laboratories
          September, 1970

Dekker, T.J.
          "Finding a Zero by Means of Successive Linear Interpolation"
          "Constructive Aspects of the Fundamental Theorem of Algebra"
          edited by B. Dejon and P. Henrici

The utility posted on this page is based on the program "FZERO.F", written by L. F. Shampine (SNLA) and H. A. Watts (SNLA), based upon a method by T. J. Dekker.
"FZERO.F" is part of the SLATEC library of programs, and its original code (written in FORTRAN) can be viewed there.
Before being posted on this page, "FZERO.F" was translated to Javascript and extensively edited, customizing the algorithm for this particular application. Although all care was taken to ensure that it was translated accurately, some errors may have crept into the translation. These errors are mine; the original FORTRAN routines have been thoroughly tested and work properly. Please contact the webmaster to report any errors.

In its most succinct form, Kepler's Equation for Elliptical Motion is stated as

E - e sin(E) = M

where E is the eccentric anomaly;
e is the eccentricity of the motion (0 < e < 1 for an ellipse); and
M is the mean anomaly, 2πt/Tt is the time since periapse, and T is the period of the motion).

To use this utility, you need to know e, T, and t--where t is the time since periapse. This routine will then calculate E at time, t, and the true anomaly, η.

Note that the results returned by this utility are confined to the range of a single revolution (t values are truncated to fractions of T:   t modulus T). If you are seeking results for t greater than T, simply add the output results to the appropriate number of complete revolutions.

Also note that this utility only accepts positive values for t. If a negative value is entered, a message box pops up, stating that a negative value was entered, but no further action will be taken. To find the eccentric and true anomalies for a negative value of t, convert the t value to the appropriate value after periapse (t = abs(t)). Then change the output results to negative values.

IMPORTANT: Make sure that T and t are the same units. It doesn't matter if both are seconds, minutes, days, years, etc--so long as they are the same units.

e: T: t:
E: rads   =   degrees
η : rads   =   degrees
Number of Function Evaluations:
Machine Epsilon:
Error Code:
Error Code = 1:         The zero is within the requested tolerance (on the order of Machine Epsilon), the interval has collapsed to the requested tolerance, the function changes sign over the interval, and the function decreased in magnitude as the interval collapsed.
Error Code = 2:         A zero has been found, but the interval has not collapsed to the requested tolerance.
Error Code = 3:         MAXIT (100) function evaluations. The solution may be meaningless. Check it.


Return to Math Functions Page

View work on a theoretical solution Home