Celestial Programming : Truncated Implementation of ELP-82

This one is long enough that it can hardly be called a "snippet". This is an implementation of the truncated version of ELP 2000/82 presented in Meeus' Astronomical Algorithms. The output is the geocentric ecliptic latitude and longitude in degrees, and the distance in kilometers. Since those coordinates aren't too useful to most amateurs on their own, I have also included routines to reduce the position to the RA/DEC of date corrected for parallax for a given location on Earth's surface. I have not included routines for conversion from UTC to Dynamical Time, nor have I accounted for light time. So, compared to JPL Horizons, which does implement those corrections, the results are off by about 30 arc seconds. If your application requires it, adding in those adjustments should bring the agreement to within a few arc seconds, Meeus claims 4". So just adding the UTC to TT conversion should produce accurate results, and further corrections likely won't produce better results.

The example below defaults to the example from Meeus' Astronomical Algorithms, page 342. I have included a manual field for ΔT. To get a close match on the data from JPL Horizons use a ΔT of 68.6954, to reproduce the results from the book set ΔT to 0. The results from JPL Horizons are 134.97583 13.33982 (topocentric), and the results from the book are 134.688470 13.768368 (geocentric). If you look in the JavaScript Console I have computed the differences of the JPL data. I have used Louisville, KY (-85.7636,38.2464000) as the position for adjusting for parallax.

JD:
ΔT:
Lattitude:
Longitude:
RA (of date):
geocentric
Dec (of date):
geocentric
RA (of date):
topocentric
Dec (of date):
topocentric
Distance:

The ELP specific functions have been wrapped in their own class ELP82, the helper functions which convert the coordinates to something more useful are inline below the class.