The definitive source of information about the position of the Sun, Moon and planets can be found at the NASA Jet Propulsion Laboratory. The data is named DE4XX, where the latest is DE438. The data comes in ASCII files which span over 1,000 years from 1550 to 2650. The data sets are updated periodically, usually as a result of improved data from space probes. The data is calculated using numerical integration based on actual data and so is quite accurate.
The DE438 data is in a set of ASCII files. The header file header.438 describes the data and defines constants. The data files ascp01550.438 through ascp2550.438 contain large numbers of data values. The file testpo.438 contains results for testing. The JPL data files can be found here.
The header file
header.483 is the key to understanding the data. The header file has a number of groups starting with a number of the form 10XX.
GROUP 1010 defines the ephemeris number and the start and end dates 1549-12-21 to 2650-01-25.
GROUP 1030 defines the start Julian date, the end Julian date and the duration of each data block - 32 days.
GROUP 1040 contains the labels of 576 constants. The labels are rather cryptic.
GROUP 1041 contains the data for the 576 constants.
GROUP 1050 defines the data for each of the bodies. The first row contains the data offset for the start of the data for each planet. The second row contains the number of Chebychev polynomial coefficents for each of the bodies. The third row contains the number of time intervals each body's data is split into.
The order in which the bodies are defined is:
There are 11 data files which contain the actual coordinate data for each of the bodies. Each data file spans 100 years. They are named
Each data file contains 1142 blocks of 1018 values. The first two values in each block are the start Julian date and the end Julian date for the block. Each block spans 32 days.
Using the offsets given in header group 1050 we know that the 3rd value in each block is the start of the data for Mercury. The 171st value in each block is the start of the data for Venus. This means that there are 168 values for Mercury in each block.
Header group 1050 tells us that there are 4 time intervals for Mercury. This means that the 168 values for Mercury are divided into 4 consecutive blocks of 42 values each defining data for
interval_time = 32 / 4 = 8 days.
Header group 1050 tells us that there are 14 Chebychev polynomial coefficients for each coordinate position for Mercury. This means that each block of
interval_size = 42 values is divided into 3 consecutive sets of 14 values, one for
each of the x, y and z axes.
To calculate the position of Mercury for a Julian date
start_date <= t < end_date.
interval = floor((t - start_date) / interval_time).
The date needs to be converted into a Chebychev time in the range
tc = 2(t - start_date - interval * interval_time) / interval_time - 1
The Chebychev coefficients for the x coordinate are the 14 values
Ci starting at offset
3 + interval + interval_size from the data block.
The Chebychev terms
Ti are defined as
T0 = 1,
T1 = tc,
Ti = 2 * tc * Ti-1 - Ti-2.
The Chebychev velocity terms
T'i can be determined by differentiating the Chebychev terms
T'0 = 0,
T'1 = 1,
T'i = 2 * Ti-1 + 2 * tc * T'i-1 - T'i-2.
The position can be calculated as
x = ΣCiTi. The velocity can be calculated as
x' = ΣCiT'i.
The y and z positions and velocities can be calculated from the next two 14 values in the data block.