A Tutorial in Generating Ephemerides from Orbital Elements
With a few racist comments added just to stay in practice.
One thing that I discovered when I was learning how to do this is how much fun a practical use for mathematics can be, especially when you know that Nature will invariably prove you to be right if you don't make any mistakes. You almost get a "master of the universe" kind of feeling, knowing that a planet WILL BE at such-and-such a place at a given time, and there's nothing and nobody who can make it be anything different.
I hope to find the time to present two further web pages on this subject. One of them will deal with the determination of a preliminary set of orbital elements from three sets of angle-only (right ascension and declination) geocentric positions for a planet at known times. The other page will relate the technique of improving a preliminary set of orbital elements by means of a generalized least squares, with the elements being variables in a system of partial differential equations to be solved simultaneously.
But for now, you racist amateur astronomers will have to be satisfied with this page, which begins with a known set of orbital elements and a specified time for the prediction, and calculates the heliocentric and geocentric position vectors from them.
Episodically, on this page, I'll go off on a digression from the main task. These digressions usually contain supplementary information that you might find useful, and I have put them in indented orange type. If the digression is exceptionally long, then I'll put it in a special section near the bottom of this page.
Okay, having had a few more days to study orbits, I'm prepared to give both revised data and a revised procedure. Here's the revised data.
| Planet | a | e | i | W | w | M JD 2451543.5 |
reciprocal mass |
| Mercury | 0.387098 +1.8E-11 |
0.205635 +5.59E-10 |
7.0047 +5.00E-8 |
48.3313 +3.24587E-5 |
29.1241 +1.01444E-5 |
168.6562 +4.0923344368 |
6023600.0 |
| Venus | 0.723330 +2.5E-11 |
0.006773 -1.302E-9 |
3.3946 +2.75E-8 |
76.6799 +2.46590E-5 |
54.8910 +1.38374E-5 |
48.0052 +1.6021302244 |
408523.71 |
| Earth | 1.00000011 -1.4E-12 |
0.016709 -1.151E-9 |
0.000 0.000 |
0.000 0.000 |
102.9404 +4.70935E-5 |
356.0470 +0.9856002585 |
328900.56 |
| Mars | 1.523688 -2.0E-9 |
0.093405 +2.516E-9 |
1.8497 -1.78E-8 |
49.5574 +2.11081E-5 |
286.5016 +2.92961E-5 |
18.6021 +0.5240207766 |
3098708.0 |
| Jupiter | 5.202560 0.000 |
0.048498 +4.469E-9 |
1.3030 -1.557E-7 |
100.4542 +2.76854E-5 |
273.8777 +1.64505E-5 |
19.8950 +0.0830853001 |
1047.3486 |
| Saturn | 9.554750 0.000 |
0.055546 -9.499E-9 |
2.4886 -1.081E-7 |
113.6634 +2.38980E-5 |
339.3939 +2.97661E-5 |
316.9670 +0.0334442282 |
3497.898 |
| Uranus | 19.18171 -1.55E-8 |
0.047318 +7.45E-9 |
0.7733 +1.9E-8 |
74.0005 +1.3978E-5 |
96.6612 +3.0565E-5 |
142.5905 +0.011725806 |
22902.98 |
| Neptune | 30.05826 +3.313E-8 |
0.008606 +2.15E-9 |
1.7700 -2.55E-7 |
131.7806 +3.0173E-5 |
272.8461 -6.027E-6 |
260.2471 +0.005995147 |
19412.24 |
| Pluto | 39.48169 0.000 |
0.248808 0.000 |
17.14175 0.000 |
110.3035 0.000 |
113.7633 0.000 |
14.704 +0.003975571 |
1.35E+8 |
| Ceres | 2.7672480 0.000 |
0.07874393 0.000 |
10.58385 0.000 |
80.48975 0.000 |
73.97953 0.000 |
5.79049 +0.2141075345 |
1E+15 |
| Pallas | 2.7733539 0.000 |
0.22984892 0.000 |
34.84040 0.000 |
173.19180 0.000 |
310.33680 0.000 |
352.59944 +0.213400845 |
1E+15 |
| Juno | 2.6685858 0.000 |
0.25898010 0.000 |
12.96761 0.000 |
170.14527 0.000 |
248.07090 0.000 |
239.97818 +0.2260905018 |
1E+15 |
| Vesta | 2.3607750 0.000 |
0.0897530 0.000 |
7.13464 0.000 |
103.95096 0.000 |
149.45857 0.000 |
340.72179 +0.2717203578 |
1E+15 |
| 2001XU | 2.5717722 0.000 |
0.8382183 0.000 |
19.061710 0.000 |
261.61574 0.000 |
285.45690 0.000 |
176.44844 +0.238976576 |
1E+15 |
As usual...
(a) is the semimajor axis of the orbital ellipse, in astronomical units (AU). One AU is 149,597,870,691 meters.
(e) is the eccentricity of this ellipse.
(i) is the inclination of the plane of the planet's orbit to the plane of the Earth's orbit, in degrees. The plane of the Earth's orbit is called "the ecliptic."
(W) is the longitude of the ascending node, in degrees. It's the angle, subtended at the center of the sun, from the Vernal Equinox, along the ecliptic, to the place at which the planet's orbit crosses the ecliptic "rising."
All right, I'll clear up my loose terminology. At the ascending node, a planet is passing through the ecliptic (the plane of Earth's orbit) with the perpendicular component of its motion in the direction from which an observer, looking back toward the sun, would see Earth moving around the sun in a counterclockwise direction.
(w) is the argument of perihelion, in degrees. It's the angle, subtended at the center of the sun, from the ascending node, along the planet's orbit in the direction of the planet's motion, to the planet's perihelion. Perihelion is the point where a planet is closest to the sun.
(M) is the mean anomaly, in degrees, of the planet at Julian Date JD 2451543.5, which corresponds to 0.0 hours Universal Time beginning the day of 31 December 1999.
What is the "mean anomaly"? A Jewish farm worker is a good guess, but that's not the mean anomaly being used here. An anomaly an angle similar to longitude. Imagine a fictitious planet moving in a circular orbit, in the same plane as the actual planet's orbit, having a radius equal to the semimajor axis of the actual planet's orbit. The constant angular speed of the fictitious planet is equal to the average angular speed of the actual planet, meaning that both complete one orbit in the same amount of time. We further suppose that an observer at the center of the sun would see the actual planet eclipse the fictitious planet when the actual planet arrives at a perihelion. The mean anomaly is the angle, subtended at the center of the sun, from the actual planet's perihelion to the point where the fictitous planet would be at a specified time. If the actual planet is again at a perihelion at that specified time, the mean anomaly has a value of zero.
Reciprocal mass is the Sun's mass divided by the planet's mass. In the case of asteroids, I assigned 1+E15 arbitrarily to this ratio because it's at the double precision limit of the software I wrote. One solar mass is 1.99E+30 kilograms.
Underneath each of the orbital elements is a number that specifies the daily rate of change in the element above it, if the rate is known. The elements are most accurate for JD 2451543.5, and for every day future of that day the element should be incremented by the daily rate of change. I'm sure you can keep track of the minus signs as well as I can, so I won't bother with more explanation. For dates within a few years of the epoch of the elements, you probably don't need to implement these adjustments, except the daily motion adjustment to M, but I'll use all of them in my example.
Most of the people who use orbital elements to predict planets' positions in the sky prefer to hold a single time (called the "epoch") for all the planets' elements and allow the mean anomaly to depend on this time. I had been doing the opposite, namely insisting on a reference to a perihelion passage and making the time depend on this particular value (zero) for the mean anomaly. But I've decided to adjust my habits to match what appears to be the more conventional practice.
First, you need to decide which day and which planet you want a prediction for. I will choose Mars on 0.0 hours UT on 27 August 2003. Using magic, I discover that this corresponds to Julian Day 2452878.5. This day is future of the epoch for the elements by 1335 days. Find the time difference like this:
dt = T - T0
Where T is the time of your prediction and T0 is the epoch of the elements for your chosen planet.
Mars has an average daily angular motion, dM, of +0.5240207766 degrees. Its mean anomaly increases by that much each day. So in 1335 days, the mean anomaly given in Table 1 (18.6021 degrees) will increase by 699.5678 degrees, which adds up to 718.1698 degrees (the M'' in the equations below). However, we desire the mean anomaly adjusted to the interval 0 to 360 degrees, which means that we must subtract the extraneous revolutions.
When we do this, we obtain the value of the mean anomaly in degrees Mdeg to be 358.1698 degrees, except that we must express it in radians, so that the equations will work right. The mean anomaly, M, then and finally, is 6.2512429 radians.
If you are not given a value for the planet's average daily angular motion, it can be calculated from the mass of the planet and the semimajor axis of its orbit.
dM = 360 degrees (1 + mass) / { 365.256898326 a1.5 }
When calculating ( dM ), you should take as ( a ) the average of the semimajor axis at the element epoch and the semimajor axis at the time of observation.
Knowing the exact epoch is important for the mean anomaly, because this element changes as the planet moves around the sun. It is intended to be time dependent because it is the element that, after a little fiddling, locates the planet at a definite point in its orbit at a definite time. The time dependence of the other elements is the unavoidable effect of the gravitational influence of other planets.
The next step is to calculate the eccentric anomaly from the mean anomaly and the eccentricity.
The equation isWhat is the "eccentric anomaly"? An intelligent Black person is certainly anomalous enough to be eccentric. But here we are referring to an angle, subtended at the center of the orbital ellipse, between the planet's perihelion and a point on a circle circumscribing the planet's orbit, which circle meets the orbital ellipse tangently at its apsides, and which point is found by projecting a line perpendicular to the orbit's major axis through the planet's position in its orbit until it intersects the aforementioned circle. (This circle is not the circular orbit of the fictitious planet mentioned in the definition of the mean anomaly, although the two circles are the same size.)
M = u - e sin u
However, this equation is set up to solve for what we already know, using what we don't know as one of the inputs. Obviously, that's got to change. Solving that equation for the eccentric anomaly (u) isn't analytically possible by means of algebra, since the sought variable occurs both inside and outside of a transcendental function. But there are iterative ways to reach a solution. Here's one based on Newton's Method:
|
u0 = M
ui+1 = ui + (M - ui + e sin ui) / (1 - e cos ui) |
Repeat the implied iteration in the second line, above, until (u) converges; that is, until ui+1 and ui are so similar to each other than you can't tell them apart.
Mars' eccentricity on 27 August 2003 is
0.093405 + (1335)(2.516E-9) = 0.093408
and
|
u0 = 6.25124293 u1 = 6.24795256 u2 = 6.24795258 u3 = 6.24795258 |
That will do. The eccentric anomaly, then, is 6.24795258 radians. Let's check.
M = u - e sin u = 6.24795258 - 0.093408 sin(6.24795258) = 6.25124292
Close enough. Our value for the eccentric anomaly checks.
Occasionally, an object (such as a comet) will have an orbital eccentricity high enough to prevent the convergence of the eccentric anomaly by the Newton's method procedure. The derivative hits a pothole that sends the next value of u skittering off toward infinity. In such cases, you should be prepared to find the eccentric anomaly by some automated process of reverse interpolation. That is, have the computer try out values for u until you get a ui and a ui+1 that yield trial mean anomalies Mi and Mi+1 that bracket the value of M that you know to be correct. Then you can interpolate linearly to get the proper value for u, or something tolerably close to it. You can also use a third trial (u, M) pair to form a quadratic interpolating polynomial, and this will get an even better eccentric anomaly. But use Newton's method if you can, because when it works (which is nearly all the time) it's better than any reverse interpolation method.
We now figure the position of the planet in a right-handed coordinate system based on the orientation of its orbit in space. In this coordinate system, the origin will be the center of the sun, and the XY plane will be the plane of the planet's orbit. The X axis will be positive in the direction that runs through the perihelion. The Z axis will be positive in the direction from which, if you looked back down toward the solar system, you'd see the planet moving around the sun in a counterclockwise direction. The Y axis will be positive in the direction from which, looking back toward the sun, the positive X axis will be 90 degrees counterclockwise of the positive Z axis, which is necessary to the definition of "right-handed" coordinate systems, as any math teacher knows, unless she's one of those Affirmative Action niggers.
The position of the planet will be given by
|
x1 = a { cos(u) - e }
y1 = a (sin u) (1 - e2)1/2 z1 = 0 |
Mars' semimajor axis on 27 August 2003 is
1.523688 + (1335)(-2.0E-9) = 1.523685
and
|
x1 = +1.380415
y1 = -0.05343781 z1 = 0 |
We can immediately use the Pythagorean theorem on the above to find that Mars will be 1.381449 AU from the sun on 27 August 2003.
The true anomaly (F) is the angle, subtended at the center of the sun, from the planet's perihelion to the planet's current position.If you had any need for it, you could find the true anomaly like so:
If x1 (is not equal to) 0, then
else ( if x1 = 0 ), thenF = Arctan( y1 / x1 )
If x1 (is less than) 0 then increase F by p radians.
If { x1 (is greater than) 0 } and { y1 (is less than) 0 } then increase F by 2p radians.if y1 (is less than) 0, then F = -p/2
if y1 = 0, then F = 0
if y1 (is greater than) 0, then F = +p/2
We next perform a series of coordinate rotations. We rotate the "1" coordinate system about the Z axis by the negative argument of the perihelion to arrive at the "2" coordinate system. The components of the planet's position vector in the "2" coordinate system are found from
|
x2 =
x1 cos w -
y1 sin w
y2 = x1 sin w + y1 cos w z2 = z1 |
Mars' argument of perihelion on 27 August 2003 is
286.5016 + (1335)(+2.92961E-5) = 286.5407 degrees, or 5.001079 radians
and
|
x2 = +0.3417729
y2 = -1.3385036 z2 = 0 |
We rotate the "2" coordinate system about the X axis by the negative inclination to arrive at the "3" coordinate system. The components of the planet's position vector in the "3" coordinate system are found from
|
x3 = x2
y3 = y2 cos i z3 = y2 sin i |
Mars' inclination on 27 August 2003 is
1.8497 + (1335)(-1.78E-8) = 1.8497 degrees, or 0.032283 radians
and
|
x3 = +0.3417729
y3 = -1.3378062 z3 = -0.0432033 |
We rotate the "3" coordinate system about the Z axis by the negative longitude of ascending node to arrive at the "4" coordinate system. The components of the planet's position vector in the "4" coordinate system are found from
|
x4 =
x3 cos W -
y3 sin W
y4 = x3 sin W + y3 cos W z4 = z3 |
Mars' longitude of ascending node on 27 August 2003 is
49.5574 + (1335)(+2.11081E-5) = 49.5856 degrees, or 0.865432 radians
and
|
x4 = +1.2401477
y4 = -0.6070978 z4 = -0.0432033 |
The "4" coordinate system is heliocentric ecliptic coordinates. That is,
|
xMars,HEC = +1.2401477
yMars,HEC = -0.6070978 zMars,HEC = -0.0432033 |
After we repeat the above procedure (yes, the whole thing) for Earth for the same date of observation, we get:
|
xEarth,HEC = +0.9030730
yEarth,HEC = -0.4533902 zEarth,HEC = 0 |
We now subtract Earth's position vector from Mars' position vector, to get the geocentric position of Mars in ecliptic coordinates.
|
dxHEC =
xMars,HEC - xEarth,HEC
dyHEC = yMars,HEC - yEarth,HEC dzHEC = zMars,HEC - zEarth,HEC |
|
dxHEC = +0.3370747
dyHEC = -0.1537076 dzHEC = -0.0432033 |
You can use the Pythagorean theorem on that vector difference to get the distance from Earth to Mars on 27 August 2003, namely 0.3729771 AU.
We must now extrapolate the Earth's obliquity for 27 August 2003. The equation to use is
Q = 23.439282 - 3.563E-7 (T - 2451543.5)
Where T is the Julian Date of interest and Q is the obliquity in degrees. However, we will convert it to radians immediately afterward. In our example, T=2452878.5, and therefore the obliquity is 23.438806 degrees, which is the same as 0.4090843 radians.
We rotate the "HEC" coordinate system about the X axis by the negative obliquity to arrive at the "GCC" coordinate system. The components of the planet's position vector in the "GCC" coordinate system are found from
|
dxGCC = dxHEC
dyGCC = dyHEC cos Q - dzHEC sin Q dzGCC = dyHEC sin Q + dzHEC cos Q |
|
dxGCC = +0.3370747
dyGCC = -0.1238395 dzGCC = -0.1007786 |
The "GCC" coordinate system is geocentric celestial coordinates. From the GCC vector, we can determine the geocentric distance, declination, and right ascension of Mars on 27 August 2003.
|
R = (dxGCC2
+ dyGCC2
+ dzGCC2)1/2
d = arcsin( dzGCC / R ) If dxGCC is NOT zero, then a = arctan( dyGCC / dxGCC )If dxGCC = 0, then If dyGCC < 0, then a = -p/2 radians |
d is the declination. To convert to decimal degrees, multiply by 180 and divide by p.
a is the right ascension. To convert to decimal hours, multiply by 12 and divide by p.
For Mars on 27 August 2003,
|
R = 0.3729771 AU
d = -15.676199 degrees a = +22.655128 hours |
Those values for R, d, and a are the answers that we've been looking for. The declination and right ascension will let you find Mars' position on a Star Atlas, so that you can check which constellation the planet will be in on the date you selected to predict for. Then, when that day rolls around, you can walk outdoors before sunrise and find it where you figured it would be.
As far as I can tell, the approach of Mars to Earth on 22 August 1924 (0.3728226 AU) is the nearest the two planets have been in all of recorded history. There is some uncertainty about it, of course, due to the accuracy of the orbital elements. But if there has been a closer pass, ever, then I can't tell when it happened. The upcoming 2003 approach seems to be the closest pass in history, except for the one in 1924.
On 31 December 1999, the orbits of Mars and Earth were separated by 0.3726689 AU at their nearest point. Presently, the orbits are shifting in such a way that this minimum distance is shrinking slightly. If the time derivatives of the elements given in Table 1 remain valid, there should be even closer approaches in the future, such as these
24 Aug 2208 0.3725092 AU 28 Aug 2287 0.3721983 AU 30 Aug 2571 0.3720219 AU 03 Sep 2650 0.3715915 AU
I wrote a program to find the planets on a date you give it, using the method described above. Click to download as a zip archive file (92 kB).
I found this spell years ago in an old tome, whose title and author I have since forgotten. To convert a calendar date into Julian Day number, follow this procedure:
We might wish to know the planet's velocity at the same time that the planet was found in the HEC position just calculated. To do that, we would find HEC position vectors for three different times, which we'll call Time A (TA), Time B (TB), and Time C (TC), in chronological order.
If (TB-TA) = (TC-TB), then to get the velocity of the planet at Time B, we may proceed as follows:
THE EASY METHOD
Vx = ( XC - XA ) / (TC - TA)
Vy = ( YC - YA ) / (TC - TA)
Vz = ( ZC - ZA ) / (TC - TA)
Otherwise, if TB is not midway between Time A and Time C, do this instead:
THE TOUGH METHOD
| k1 = (TB - TC) / [(TA - TB) (TA - TC)] |
| k2 = (2TB - TA - TC) / [(TB - TA) (TB - TC)] |
| k3 = (TB - TA) / [(TC - TA) (TC - TB)] |
| Vx = k1 XA + k2 XB + k3 XC |
| Vy = k1 YA + k2 YB + k3 YC |
| Vz = k1 ZA + k2 ZB + k3 ZC |
| If you are a Black, then you probably don't know why this works. |
The easy method for approximating the velocity at Time B assumes that the planet moves in a straight line between known positions. That's a false assumption, but it is nearly true if the times chosen are close enough together. However, beware of the limits of your computational accuracy as well. You do want to avoid the error of large time intervals, but picking time intervals too small may leave your position vectors insufficiently distinct from each other to give your velocity a decent number of accurate significant digits.
The tough method is based on a time derivative of the Lagrange interpolating polynomial of degree 2 that fits the three points given (with each spatial dimension being treated as a separate case). The tough method has the advantage of not requiring the "time of observation" to be exactly in the middle (in time) of a known past position and a known future position, though it should still be somewhere in between them.
For example, suppose we determine that Mars will have these HEC positions at these times:
| T | X | Y | Z |
| JD 2452872.0000 | +1.19377911 | -0.69506576 | -0.04390496 |
| JD 2452873.0000 | +1.20128666 | -0.68173630 | -0.04381048 |
| JD 2452874.0000 | +1.20865951 | -0.66833039 | -0.04371109 |
By both methods, we get this velocity vector:
Vx = +12.8824 km/sec
Vy = +23.1456 km/sec
Vx = +0.1678 km/sec
The Vis Viva equation says
V = [ GM (2/r - 1/a) ]1/2
Using the Pythagorean theorem on the position at Time B in the example above, we get
r = 1.38194551 AU = 2.06736105E+11 meters
I'm using a lower-case "r" to represent the distance between the sun and the planet because I have already used the capital "R" to represent the distance between Earth and the planet. But this shouldn't confuse anybody who has stayed awake this long.
Mars' semimajor axis,
a = 1.523688 AU = 2.279405E+11 meters
GM is the gravitational constant times the sun's mass.
GM = 1.32712440018E+20 m3 s-2
Therefore, the actual value of Mars' speed at Time B is 26.4888 km/sec. For comparison, our approximation to that speed is 26.4897 km/sec. We were off by less than one meter per second. This is a tribute to the reliability of the method only, however; our uncertainty in the length of Mars' semimajor axis confers a substantially larger potential error in the orbital speed.
This time I chose the asteroid 2001-XU as my feature attraction. The minimum approach distance (given these elements) is only about 19,000 kilometers. Naturally, I looked ahead a ways. XU appears to be in an 8:33 orbital resonance with Earth, meaning that it flies close by us at 33-year intervals, on every 8th time it goes through the place where it's orbit approaches Earth's orbit. None of these sessions is deadly close, however, for as far into the future as I can rely on these elements. On the other hand, it wouldn't take much of a bump, tug or perturbation to put XU right smack on a collision course. And it's not the only asteroid of this kind. JPL keeps a list of the asteroids that are, like Mexican immigrants, known to be potential troublemakers.
2001-XU has a "solar system scale" absolute magnitude of 19.01, which means (hiding the arithmetic) that it might weigh around 330 billion kilograms. Oh, you want to see the arithmetic? Oh, very well. According to JPL, an asteroid with an absolute magnitude of 22.0 will be 150 meters in diameter, if its albedo (surface reflectivity) is the typical value of 0.13. A difference of one magnitude corresponds to an increase or decrease in reflected power by the fifth root of 100, or 2.511886431. Thus for 2001-XU,
Reflected power = 100(22-19.01)/5 = 15.7
As compared to the reflected power from a 150-meter asteroid. Reflected power varies according to surface area, which depends on the square of the average radius. So 2001-XU is about 3.96 times as wide as a 150-meter asteroid is. It's radius is about 297 meters. If we pretend that the asteroid is spherical, then the volume is 110 million cubic meters. If we assume that the average density is 3000 kilograms per cubic meter (typical for rock), the mass is about 330 billion kilograms. (No attempt at precision has been made; this is just a ballpark calculation.)
Here's an equation that I put together to let you reach the impact energy directly.
K = 1.26 megatons TNT { 1000.3(22-MAG) } V2
Where K is kinetic energy, MAG is the asteroid's absolute magnitude, and V is the asteroid's speed relative to Earth at impact, in kilometers per second. The equation implicitly assumes that the asteroid reflects 13% of incident sunlight. You would discover the relative speed by using the procedure described in the first section of this page for two (proximate) times of observation, and then finding the length of the vector difference of the two geocentric position vectors, and dividing that length by the time between the two observations.
If 2001-XU ever hits Earth, it will be moving at 28.9 km/sec, which corresponds to an impact energy of 2.76+20 Joules, which is equivalent to 65,600 megatons TNT (or 65.6 gigatons). This kind of thing might, possibly, you know, destroy the world.
If the elements that I have are right, the asteroid 2000-QK130 will approach Earth by 337,000 kilometers on 14 March 2190. As such things go, this "miss" isn't enough to singe the eyebrows with heat, but it is close enough to raise them in surprise. On 9 September 2242, the asteroid 1997-XR2 will pass by 169,000 km (about half the distance to the moon).
Earth really is in a low-density "bullet shower," and it would be worthwhile to take out some planetary insurance by putting into space some means by which asteroids bound for a future collision with Earth can be intercepted and deflected. It is unfortunate that the international political mess created by the Jews, and the treason of the US government for letting itself become an instrument of Zionism, may preclude the creation a means by which we might save ourselves from an impact cataclysm. Asteroid impacts are a bit like house fires: the preparations for saving the home must be made well in advance, since, once you can smell the smoke, it's too late. As things stand at present, if an asteroid were discovered to be on a collision course, nothing whatever could done in sufficient time.
I mentioned in a previous version of this page that I had figured out a way to get the distance of nearest approach between any two elliptical orbits. It's nothing complicated (or anyway, not if you're White). For this problem, you don't need to know where the planet is in its orbit at any particular time, so you can ignore the epoch of mean anomaly and time of perihelion passage. But you do still need the other elements ( a, e, i, W, w ).
The trick is in realizing that you can vary the eccentric anomaly of either orbit independently of the other orbit. This allows you to construct a two-dimensional map where the eccentric anomaly along one orbit is an index across the rows, while the eccentric anomaly of the other orbit is an index down the columns. In computer programming, this translates to a nested loop with indices used internally to find the minimum of a function.
How you go about finding that minimum can possibly be chosen from any number of clever strategies, but I used the plain old peck-peck-peck method, except I added an outer loop for homing in on the part of the barnyard where the feed is the thickest.
In the procedure below, for variables having two subscripts, the first subscript will designate which orbit (either 0 or 1) and the second subscript will designate either the beginning (0) or the end (1) of an eccentric anomaly search interval. For variables having only one subscript, the subscript will specify which orbit. All eccentric anomalies, and all other angles, are used only in radians.
u00 = 0
u01 = 2p
u10 = 0
u11 = 2p
drmin = 9.9E+99
drgrandmin = 9.9E+99
count = 0
Repeatcount = count + 1Until { Q (is less than) 1e-12 } or { count (is greater than) 20 }
du0 = (u01 - u00)/100
du1 = (u11 - u10)/100
u0 = u00 - du0
Repeatu0 = u0 + du0Until { u0 (is greater than) u01 } or { du0 (is less than) 1E-12 }
x0''' = a0 (cos u0 - e0)
y0''' = a0 sin u0 (1 - e02 )1/2
x0'' = x0''' cos w0 - y0''' sin w0
y0'' = x0''' sin w0 + y0''' cos w0
x0' = x0''
y0' = y0'' cos i0
z0' = y0'' sin i0
x0 = x0' cos W0 - y0' sin W0
y0 = x0' sin W0 + y0' cos W0
z0 = z0'
u1 = u10 - du1
Repeatu1 = u1 + du1Until { u1 (is greater than) u11 } or { du1 (is less than) 1E-12 }
x1''' = a1 (cos u1 - e1)
y1''' = a1 sin u1 (1 - e12 )1/2
x1'' = x1''' cos w1 - y1''' sin w1
y1'' = x1''' sin w1 + y1''' cos w1
x1' = x1''
y1' = y1'' cos i1
z1' = y1'' sin i1
x1 = x1' cos W1 - y1' sin W1
y1 = x1' sin W1 + y1' cos W1
z1 = z1'
dx = x1 - x0
dy = y1 - y0
dz = z1 - z0
dr = (dx2 + dy2 + dz2)1/2
If dr (is less than) drmin thendrmin = dr
u0,min = u0
u1,min = u1
x0,min = x0
y0,min = y0
z0,min = z0
x1,min = x1
y1,min = y1
z1,min = z1
u00 = u0,min - du0
u01 = u0,min + du0
u10 = u1,min - du1
u11 = u1,min + du1
Q = abs(drgrandmin - drmin) / drmin
If drmin (is less than) drgrandmin then drgrandmin = drmin
At the end of that procedure, drgrandmin should be the minimum distance between the orbits. I wrote a program to find the minimum distance between two orbits when you give it their elements. Click to
download (92 kB).
This method of interpolation is highly versatile and is well-suited to the White racist astronomer on the go. Given n unique points (x,y), there exists a polynomial of degree n-1 that passes through those points. If you have two points, there's a line. If you have three points, there's a parabola (or a line, if they are colinear). And so on.
In general, you have points
(x1, y1), (x2, y2), (x3, y3), . . . , (xn, yn)
Then P(x) =
y1
{
(x - x2)
(x - x3) ...
(x - xn)
} /
{
(x1 - x2)
(x1 - x3) ...
(x1 - xn)
}
+
y2
{
(x - x1)
(x - x3) ...
(x - xn)
} /
{
(x2 - x1)
(x2 - x3) ...
(x2 - xn)
}
+ ...
+
yn
{
(x - x1)
(x - x2) ...
(x - xn-1)
} /
{
(xn - x1)
(xn - x2) ...
(xn - xn-1)
}
In my experience, the most useful of these polynomials is the one of 2nd degree, the parabola, which requires three known (x,y) points to generate. Most of the time, your data points are going to be more-or-less linearly distributed, or else there's going to be some curvature to them that "holds water" in the same direction (i.e., the curvature doesn't change from convex to concave). This isn't always true, of course! But more often than not, your data will fall either along a line or along a curve having no inflexion. Although it is possible that a polynomial of 3rd degree or higher won't "inflect" inappropriately somewhere in your interpolation interval, this possibility usually isn't worth gambling on.
For n=3, P(x) =
y1
{
(x - x2)
(x - x3)
} /
{
(x1 - x2)
(x1 - x3)
}
+
y2
{
(x - x1)
(x - x3)
} /
{
(x2 - x1)
(x2 - x3)
}
+
y3
{
(x - x1)
(x - x2)
} /
{
(x3 - x1)
(x3 - x2)
}
Sometimes you want the interpolating polynomial in order to find the derivative dP/dx, rather than the values of P themselves. Polynomial interpolation is very convenient for this purpose because they are so easy to differentiate. So I will present the derivative of the 2nd degree Lagrange interpolating polynomial.
For n=3, dP/dx =
y1
{
2x - x2 - x3
} /
{
(x1 - x2)
(x1 - x3)
}
+
y2
{
2x - x1 - x3
} /
{
(x2 - x1)
(x2 - x3)
}
+
y3
{
2x - x1 - x2
} /
{
(x3 - x1)
(x3 - x2)
}
There. Even a mestizo should have been able to follow that.