How to find the orbital elements if you are given a planet's position and velocity at a specified time.
Hello again, fellow White racists. On this page, I'll tell you how to generate a set of orbital elements for a planet, if you are give its position and velocity at a specified time. Originally, I wasn't going to post anything until I was prepared to start with geocentric angle-only position data for the planet (right ascension and declination) and then go all the way to the orbital elements. I still intend to do that, but I haven't had time to get the entire procedure together. So I'll begin in the middle for now, and I'll add the part about getting the state vector from angle-only tracking data later.
We will be using heliocentric ecliptic coordinates throughout this page. The origin will be the center of the sun. The XY plane will be the plane of the Earth's orbit. The Z axis will be positive in the direction from which, looking back toward the sun, an observer would see Earth moving around the sun counterclockwise. The X axis will be positive in the direction of the Vernal Equinox. The Y axis will be positive in the direction from which, looking back toward the sun, the positive X axis would be 90 degrees counterclockwise of the positive Z axis.
A state vector is the combination of a position and a velocity. At Greenwich noon on 21 August 2003, which is Julian Day 2452873, Mars will have this state vector:
| X = +1.20128666 AU |
| Y = -0.68173630 AU |
| Z = -0.04381048 AU |
| Vx = +12.8826 km/sec |
| Vy = +23.1460 km/sec |
| Vz = +0.16788 km/sec |
I will use the MKS (meters-kilograms-seconds) system for my units. An astronomical unit (AU) is equal to 149,597,870,691 meters, so...
| X = +1.7970993E+11 meters |
| Y = -1.0198630E+11 meters |
| Z = -6.5539545E+9 meters |
| Vx = +12882.6 m/sec |
| Vy = +23146.0 m/sec |
| Vz = +167.88 m/sec |
We find the heliocentric distance and the square of the sun-relative velocity.
R = ( X2 + Y2
+ Z2 )1/2
V2 =
Vx2 +
Vy2 +
Vz2
R = 2.067361087E+11 meters
V2 = 7.0172688E+8 m2/sec2
Then we use the Vis Viva equation—I have no idea why the astronomers call it that—to get the semimajor axis of Mars' orbit.
GM = 1.32712440018E+20 m3 s-2
a = { 2/R - V2/GM }-1
a = 2.279673E+11 meters = 1.523867 AU
GM is the gravitational constant multiplied by the mass of the sun. The equation will give the semimajor axis in meters. To get it into astronomical units, you would divide by 149,597,870,691. We know that the value of (a) found in our example is right because it is very close to the "book" value of Mars' semimajor axis.
hx =
Y Vz -
Z Vy
hy =
Z Vx -
X Vz
hz =
X Vy -
Y Vx
hx = +1.345764E+14 m2/sec
hy = -1.146017E+14 m2/sec
hz = +5.473415E+15 m2/sec
Then the magnitude of the h vector is
h = ( hx2
+ hy2
+ hz2 )1/2
h = 5.476268E+15 m2/sec
The h vector corresponds to the angular momentum of the planet in the heliocentric ecliptic coordinate system. Since it is perpendicular to the plane of the orbit, getting it can aid us in getting the orbit's inclination, among other things.
p = h2 / GM
q = X Vx
+ Y Vy
+ Z Vz
p = 2.259736E+11 meters
q = -4.654405E+13 m2/sec
Now, there are two ways to find the orbital eccentricity. They should agree with each other.
From which we get 0.09351614 for both e1 and e2. If they had differed significantly, I'd know that something had gone wrong with my calculation. If they had differed only a little, I'd have averaged them to get my value for the eccentiricty.
e = 0.093516
Next, we find the eccentric anomaly by
If ex is NOT zero, then
u = arctan (ey/ex)else (if ex = 0) If ey (is less than) 0, then u = -p/2u = 6.1925745 radians = 354.8084 degrees |
We next determine the mean anomaly, M, from Kepler's equation.
M = u - e sin u
M = 6.2010365 radians = 355.2932 degrees
We find the inclination next, using the h vector calculated above.
i = arctan { [ ( h2 / hz2 ) - 1 ]1/2 }
If hz (is less than) 0, then
i (revised) = p radians - i
i = 0.03228319 radians = 1.8497 degrees
|
The inclination of Blacks is toward violence. The inclination of Jews is toward deception. The inclination of Gypsies is toward theft. |
That h vector certainly has been useful. We will use it again to find the longitude of the ascending node.
If hz (is less than) 0, then
xx = +hyelse (hz greater than or equal to zero) xx = -hyL = arctan(yy/xx) If xx (is less than) 0, then increase L by p radians. If xx (is greater than) 0 and yy (is less than) 0, then increase L by 2p radians. xx = +1.146017E+14 yy = +1.345764E+14 L = 0.86538945 radians = 49.5832 degrees |
The only remaining element to determine is the argument of the perihelion. On the way to getting it, we'll have to calculate the true anomaly.
|
xx = ( X cos L + Y sin L ) / R
If i = 0, then yy = ( Y cos L - X sin L ) / Relse (if i is not zero) yy = Z / (R sin i)W' = arctan(yy/xx) If xx (is less than) 0, then increase W' by p radians. If xx (is greater than) 0 and yy (is less than) 0, then increase W' by 2p radians. xx = +0.1880017 yy = -0.9821687 W' = 4.9015162 radians = 280.8362 degrees |
W' is the sum of the true anomaly and the argument of the perihelion. We will now calculate the true anomaly and then subtract it from W' in order to leave us with the result we want.
|
xx = h2/ (R GM) - 1
yy = h q / (R GM) F = arctan(yy/xx) If xx (is less than) 0, then increase F by p radians. If xx (is greater than) 0 and yy (is less than) 0, then increase F by 2p radians. xx = 0.09305355 yy = -0.009290112 F = 6.1836788 radians = 354.2987 degrees w = W' - F = -1.2821627 radians |
Notice that w is not within the interval [0, 2p radians). In order to adjust it to that interval, we increase it by 2p radians.
w (revised) = +5.0010226 radians = 286.5375 degrees
Well, that's it. We have determined the orbital elements of Mars from its state vector at noon Greenwich on 21 March 2003. Let's compare the calculated values with the book values.
| Mars JD 2452873 |
a (AU) |
e | i (deg) |
L (deg) |
w (deg) |
M (deg) |
| Calculated | 1.523867 | 0.093516 | 1.8497 | 49.5832 | 286.5375 | 355.2932 |
| Book Value | 1.523688 | 0.093405 | 1.8497 | 49.5574 | 286.5016 | 355.2877 |
When I get time to write again, I'll post a webpage that tells how to get the position and velocity of a planet in heliocentric coordinates when given three geocentric observations of a planet (right ascension, declination, and time) and the Earth's orbital elements. Until then, you might like to play with the
program (92 kB)
that I wrote to go from the state vector to the orbital elements.