## Elliptical orbits: given position, find time

Two of the previous posts about orbits are particularly relevant to this one. Canonical units are described at the end of this post; the geometry of elliptical orbits is described in this post.

I propose to show you how to use “Kepler’s Equation” before I derive it. As we use it, we will see some of the things that enter into the derivation; just as importantly for some of us, we will see why the equation is useful. The equation actually has two parts… it is usually written

M = E – e Sin[E],

where M is called the mean anomaly, but that’s not much use unless we know M:

M = n t,

where t is the time since periapse passage (i.e. since the last time the object was at periapse), and

$n = \sqrt{\mu/a^3}\$.

okay… but what is that? Well, the period of an elliptical orbit is

$T = 2\pi \sqrt{a^3/\mu}\$,

so

$n = 2 \pi / T\$.

In other words, n is the average angular speed in radians per second, averaged over one orbit (or any number of complete orbits).

Then $M = n t = 2 \pi t / T\$,

so M is proportional to time t as a fraction of the period T.

The equation, then, is really

n t = E – e Sin E.

It relates the time t to some angle E, whatever that may be. Oh, E must be in radians.

Well, e is the eccentricity of the orbit, and E is called the eccentric anomaly. Here’s a picture:

We see an elliptical orbit in black, and a circumscribed circle in red; the radius of the circle is a, the semi-major axis of the ellipse. The two points P and Q lie on a vertical line, with P on the orbit and Q on the circle. E is the angle VZQ between periapse V and the point Q; it is located at the center of the ellipse.

By contrast, the true anomaly f is the angle VFP between periapse V and the point P on the orbit, located at the occupied focus.

I might as well point out something now while the picture is right here. The line segments SP and SQ (the y components of P and Q) have a very simple relationship:

SQ = a/b SP

or

SQ / SP = a / b

where a and b are the semi-major and semi-minor axes of the ellipse. This will let us move between true anomaly f and mean anomaly E. (There are many ways of writing the relationship between f and E; this is the one I can reconstruct for myself.)

(Why is that relationship true? The circle has equation X^2 + Y^2 = a^2, the ellipse has equation (x/a)^2 + (y/b)^2 = 1. Set x = X and we get (Y/a)^2 = (y/b)^2, hence |Y| = a/b |y|.)

So let’s solve a problem which presumes we know distance and want time. This example is from p. 189 of Bate, Mueller, and White, “Fundamentals of Astrodynamics” (see my biblio page).

“A space probe is in an elliptical orbit around the sun. Perihelion distance is .5 AU and aphelion is 2.5 AU. How many days during each orbit is the probe closer than one AU to the sun?”

Here’s what I’m going to do:

• Get lots of parameters of the orbit;
• From distance r = 1 AU, find true anomaly f;
• Draw a picture;
• from true anomaly f, find eccentric anomaly E;
• compute mean anomaly M = E – e Sin E;
• compute angular speed $n = \sqrt{\mu/a^3}\$;
• compute time t = M / n.

## Get lots of orbital parameters

Here are the given parameters:

ps={rp->.5, ra->2.5, r->1}

(Since 1 DU = 1 AU for orbits about the sun, we are effectively in canonical units… but it doesn’t really matter.)

Back in this post (previously referenced), I showed you that the arithmetic mean of the apsides ra and rp was a, the semi-major axis… and their harmonic mean is proportional to h – in fact, it’s equal to p… and their geometric mean is equal to b, the semi-minor axis. That is, without looking things up, I know I can compute b, p, and a as:

Then I would get c from a^2 = b^2 + c^2, and I know that e = c/a:

(Although I print the most recent solution, you might notice that I am concatenating them all into “sol”. Unfortunately, a couple of the snapshots were taken before I went through and rewrote everything using sol. Try not to worry about assorted s1, s2, s4 etc. – when they are replaced by sol, everything works in my notebook.)

## Get the true anomaly f

The orbit, then, is… and the true anomaly f has cosine… which means that the two values of f are… radians and then degrees:

## Draw a picture

I should draw a picture, now that I have a and b and f. I know the parametric form of an ellipse…

(I have drawn the circumscribed circle in red, again, and also the points that determine E.)

Note the black circle: it is of radius 1. It intersects our orbit in the two black points. (It also goes thru the center of the ellipse, because c = 1.) Inside that circle, the object is less than 1 AU from the sun – so what we want is the time from the lower black point, thru periapse, to the upper point.

What we will find is the time from periapse to the upper point – and double it.

## Get the eccentric anomaly E:

Note that once we knew f and r, we knew the coordinates of the red points for E wrt the occupied focus:

Then we just add {c,0} to translate those to coordinates wrt the center of the ellipse… and from those I can get the tangent of E…

(The “Sequence@@” got rid of the braces {} around the numbers in t1, by changing the head of t1; otherwise, the two-argument ArcTan fails.)

## Get the mean anomaly M:

We write the RHS… and substitute for e and E… to get M:

Note that the equation n t = E e Sin E is dimensionless. Whatever units we choose for n will determine the units of time t, and conversely. So even though we’ve been working in canonical units so far, we should compute n using physical units.

## Get the angular speed n:

$n = \sqrt{\mu/a^3}\$.

I need the gravitational constant G… the mass M of the sun… and then mu is their product, mu = G M.

Now I want a in physical units… but 1 DU = 1 astronomical unit. We have a in DU… then in AU… then $n = \sqrt{\mu/a^3}\$… plug in values… and this is n.

## Get the time t:

Finally, n t = M gets us t… but we want 2 t… and we want it in days instead of seconds:

Sweet. (That’s the answer in the book. Well, to be precise, they said “100”.)