Finding the radius of an eccentric orbit at any point

Knowing the apoapsis, periapsis and therefore period of an orbit, how can I find the radius of an object in an orbit at a given angle or time, whichever is needed.

For example, if I have an object m orbiting around object M with an apoapsis of 100m and a periapsis of 50m, what is the distance between m and M after t seconds, or at $\theta$ degrees. Which ever is needed. I say 'or' because I don't know what you would use to find the radius.

If you know the apoapsis and periapsis, you can find the eccentricity, using $r_a = a (1+e), r_p = a (1-e)$ (https://en.wikipedia.org/wiki/Apsis#Mathematical_formulae).

Using the eccentricity, you can find the radius at any angle $\theta$ from the periapsis (this angle is also called the true anomaly).

$r(\theta) = \frac{a(1-e^2)}{1+e.\cos \theta}$(https://en.wikipedia.org/wiki/Kepler_orbit#Johannes_Kepler)

With time, it is little more difficult. The mean anomaly (M) is defined as

$M = \frac{2\pi t}{T}$ where t is the time since last periapsis, and T is the time period.

This mean anomaly relates to true anomaly through a variable called eccentric anomaly (E). From mean anomaly (which you get from the time), you can get eccentric anomaly using

$M=E-e.\sin E$

Now this equation isn't analytically solvable, but you can solve it graphically or numerically, or using a simple iteration which I would demonstrate here (technically included in the numerical methods, but it's easy enough to show here). It is easy enough to be done on a simple scientific calculator.

$E_{n+1}=M+e.\sin E_{n}$ where $E_0=M$

Using this E, you can find the true anomaly $\theta$ using

$\theta=2 \tan^{-1}[ \sqrt{\frac{1+e}{1-e}} \tan \frac {E}{2}]$

Then you can find the radius as described above.

• This is much more complicated than I thought, so how would I calculate the eccentric anomaly with a single function? How do other programs do it? There are lots of programs that can plot the position of objects. Jul 7 '14 at 3:46
• With time that is, should have mentioned that. I have a graph with a point orbiting around a nother and it's position should depend on the value of time t Jul 7 '14 at 8:17
• As I mentioned, $E_{n+1}=M+e.\sin{E_n}$ is the iteration which you start with $E_0=M$. M you get directly from t. Input the M and $E_0$ and start iterating with each new value of E on the LHS that is input again into the RHS of the equation. You keep doing this till $E_{n+1}=E_{n}$. On a scientific calculator, for example, you evaluate $M+e.\sin{M}$ first, and then keep evaluating $M+e.\sin{Ans}$ (where 'Ans' is the previous answer) till you keep getting the same Ans (usually happens in 4-5 iterations). This Ans is then the value of E corresponding to the value of M. Is this clear enough? Jul 7 '14 at 10:02
• So you can go $t\rightarrow M \rightarrow E \rightarrow \theta \rightarrow r$. This looks complicated, but it's not too difficult if you can write a code/program/script. Jul 7 '14 at 10:05
• I think I get it now, (sorry this is a huge leap from Kerbal Space Program) so I simply find $M+e\sin{E_n}$, then substitute that result into $E_n$ and do it again. Thanks! Jul 7 '14 at 10:14