# Find true anomaly given period, eccentricity and time

Is it possible to find the true anomaly of an object in a Kepler orbit given the orbital period of the object, the orbital eccentricity and the time? Assuming a two body system and the mass of the orbiting body is negligible.

I'm doing this computationally so I'd like to be able to place an object on an orbital ellipse with as few evaluations as possible. I ask about these orbital elements specifically because at the time in the program that I need to calculate the true anomaly, I have these values on hand already.

## Edit

I've been searching extensively for an answer to this, and found these four steps to solving position as a function of time. The thing I'm having most trouble with is solving Kepler's equation -- it seems like there should be a simpler way to do this -- I can find the velocity at each apsis, and the orbital period relatively easily. As the eccentricity approaches 1 the orbiting object would spend more time near apoapsis and less time near periapsis -- but I can't seem to put that into numbers.

-

## 1 Answer

Kepler's equation: $M=E-\varepsilon\cdot \sin( E)$, you need to solve for $E$.

The inverse problem may be solved (according to wikipedia) as follows:

$E = \begin{cases} \displaystyle \sum_{n=1}^{\infty} {\frac{M^{\frac{n}{3}}}{n!}} \lim_{\theta \to 0} \left( \frac{\mathrm{d}^{\,n-1}}{\mathrm{d}\theta^{\,n-1}} \left( \frac{\theta}{ \sqrt[3]{\theta - \sin(\theta)} } ^n \right) \right) , & \epsilon = 1 \\ \displaystyle \sum_{n=1}^{\infty} { \frac{ M^n }{ n! } } \lim_{\theta \to 0} \left( \frac{\mathrm{d}^{\,n-1}}{\mathrm{d}\theta^{\,n-1}} \left( \frac{ \theta }{ \theta - \epsilon \cdot \sin(\theta)} ^n \right) \right) , & \epsilon \ne 1 \end{cases}$

which evaluates to:

$E = \begin{cases} \displaystyle M + \frac{1}{60} M^3 + \frac{1}{1400}M^5 + \cdots \ | \ x = ( 6 M )^\frac{1}{3} , & \epsilon = 1 \\ \\ \displaystyle \frac{1}{1-\epsilon} M - \frac{\epsilon}{( 1-\epsilon)^4 } \frac{M^3}{3!} + \frac{(9 \epsilon^2 + \epsilon)}{(1-\epsilon)^7 } \frac{M^5}{5!} + \cdots , & \epsilon \ne 1 \end{cases}$

The above is copied straight out of wikipedia. It's kind of ugly. Plus, the first equation is written in "x" instead of "M" and you can't be sure it's correct.

So instead, what I'd try is to take the first terms from the above, i.e. put $E_0 = M$ or $M/(1-\epsilon)$, and use Newton's method to iterate. That is, iterate with:
$E_{n+1} = E_n - \frac{M - E +\epsilon \sin E}{-1+\epsilon\cos(E)}$.

To test the method, run a bunch of random data through it, and make sure you test the fence posts (boundary conditions).

-
I notice the Es in the fraction in Newton's method don't have subscripts -- what value would I use for them? –  Carson Myers Mar 13 '11 at 15:50
Ooops. You use $E_n$. –  Carl Brannen Mar 14 '11 at 0:59
okay, thank you! –  Carson Myers Mar 14 '11 at 18:42