I'm creating a space exploration game in Unity 3D, written in C# and I'm currently working on a system where I plot the new position of a celestial object as a function of time. This way, I don't have to constantly calculate the position of an object, but I can use the time that has passed since the player has started playing.

I have an adequate understanding of Kepler's three laws of planetary motion and the six orbital elements. I can also calculate or randomly generate these elements.

The problem is true anomaly, as it does not change with a constant value like in a circular orbit. I need to calculate the true anomaly for my time problem.

I understand the main equations behind this element and why it is neccesary to use the mean anomaly and the eccentric anomaly. But here is where my limited knowledge of math leaves me stranded. I can not figure out how to calculate the mean anomaly and use the eccentric anomaly to reach the true anomaly. I've used many sources: Basics of orbital mechanics, Youtube etc.

The part where I get stuck is where I need to calculate the eccentric anomaly from the mean anomaly. I can not find any sources online that explain how to do this.

Can anyone explain how this works?


1 Answer 1


The reason for using mean anomaly is that the time behavior of mean anomaly is very simple: It's linear. In other words, $M(t) = M(t_0) + n(t-t_0)$ where $n$ is the "mean motion" In units of radians per time unit, mean motion is given by $n = \sqrt{G(m_1+m_2)/a^3}$.

Kepler's equation, $M=E-e\sin E$, tells how to calculate the mean anomaly $M$ given the eccentricity $e$ and the eccentric anomaly $E$. This is essentially a function definition, $M(E,e)$. You need to invert this to calculate the eccentric anomaly given the mean anomaly and the eccentricity. This, too, is a function, $E(M,e)$. While $M(E,e)$ is readily expressed in terms of the elementary functions, $E(M,e)$ is not. In fact, it is provably not invertible in terms of the elementary functions.

Solving for $E$ given $M$ and $e$ is sometimes called Kepler's problem. The standard approach nowadays is to use a Newton-Raphson iterator. Start by placing the mean anomaly calculated via $M=M_0+n(t-t_0)$ to a value between 0 and $2\pi$. Next, make an initial guess regarding the eccentric anomaly. If the eccentricity is high, the initial guess should be $E_0=\pi$. Otherwise, start with $E_0=M$.

Now start iterating using a Newton-Raphson iterator. Given a guess $E_{i}$ to the eccentric anomaly, the next guess is given by a the Newton-Raphson iterator $$E_{i+1} = E_i - \frac{E_i-(M+e\sin E_i)}{1-e\cos E_i}$$

The iteration is done when the correction term (the second term on the right hand side) becomes small.

  • $\begingroup$ Yes I know how the mean motion is linear. This is why it's simple to use it in programming. The part I don't understand is how to get the true anomaly from the mean anomaly via the eccentric anomaly. Just the mean anomaly does not give the position on an elliptical orbit. And Kepler's first law states that all orbits are elliptical, so no easy circular calculations :) $\endgroup$
    – Avanak
    Jun 20, 2015 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.