# Elliptical orbit math

In my spacecraft simulator all the ships start out orbiting something. So, at the start of the simulation I need to compute a position and velocity for each ship that places them in stable orbit round a chosen body. It is straightforward to compute the initial position and velocity for a circular orbit: the centrifugal force equals the attraction due to gravity, just solve for v.

So, for circular orbits, some very straightforward newtonian physics lets you arrive at [1]:

G being the gravitational constant, M being the mass of the central body and r being the radius of the orbit (distance from the center of the body)

For an elliptical orbit, however, what can we do? We can guess that the speed at peri-apsis (closest approach) will be higher than what we’d calculate for a circular orbit of that radius, and speed at apo-apsis (farthest point) will be slower than that for a circular orbit at that radius, but how do we compute them?

I love classical, newtonian, physics because there tend to be very elegant computations that you can do, invoking one set of principles and laws that let you arrive at answers that dove tail neatly with answers you get from applying a very different set of principles, yielding a beautiful consistency to how nature works.

In this case, we consider two things: the conservation of energy, and the conservation of angular momentum. Conservation laws seem apt things to invoke here, because we have this satellite of ours going round and round the central body, and – to a good approximation – no energy is being lost.

We have two points that constrain us: the apo-apsis and the peri-apsis. We assert that the total energy at the “top” of our orbit is the same as the total energy at the “bottom” of our orbit. Similarly we assert that the angular moment of our stone (spacecraft) twirling at the end of this virtual slingshot, spinning round our central body, is always constant.

We consider the total energy, which is the sum of the kinetic energy (due to the body’s speed) and the potential energy (due to the position of the body in the gravitational field). The craft is continually trading one for the other as it loops around: at the periapsis it is low down in the gravity well and has liquidated some of it’s gravitational potential energy into kinetic energy as it zips at it’s fastest speed past the lowest point. Then as it climbs back up, it’s kinetic energy bleeds off and is converted back into gravitational potential energy.

When we put these two sets of equations together we can eliminate one of the “v”s (we chose to eliminate v2, the velocity at apo-apsis) and get a neat expression for v1.

Looking closely at this expression we note that if we set r1 = r2, which indicates a circular orbit the expression reduces neatly to the same form as we deduced for circular orbits, showing us we are correct in our derivation and showing again, in a small way, the wonderful consistency of physics.

## 2 thoughts on “Elliptical orbit math”

1. If you’re developing a spacecraft simulator from scratch, and someday you find yourself with a little time to kill, be sure to check out STK (http://licensing.agi.com/stk/). It’s a state-of-the-art trajectory modeling and viz tool that’s very popular in the aerospace industry.

2. Hi Andy! I’ve been to the STK website, but I’ve never tried it out. I see they have a free trial. Another one is NASA’s GMAT. Thanks for reading.

This site uses Akismet to reduce spam. Learn how your comment data is processed.