# Calculating velocity of Earth from JPL DE

We have discussed how to calculate positions from JPL development ephemerides in this question.

Following this answer, I am now using SPICE's algorithm for calculating the derivatives of the Chebyshev sums, which are in fact the derivatives of the positions, i.e., velocities.

However, for the case of Earth and Moon, as previously discussed, JPL DE in fact provide the Chebyshev coefficients for the Earth-Moon barycenter (EMB), not for the Earth alone, as well as for the Moon itself. For calculating positions, this is not much problem, since we can use the Earth-Moon mass ratio together with the calculated positions of Moon and EMB to calculate the position of the Earth.

However, this leaves me wondering, if we use the derivative of Chebyshev sums, we would in fact get the velocity of the EMB with respect to the Solar System Barycenter, as well as the velocity of the Moon with respect to the Earth. How can we use this information to calculate the velocity of Earth with respect to the SSB?

It should be quite obvious that you compute the velocity of the Earth the same way you compute the position. It's multiplying a function by a constant, and that constant will be unaffected by the derivative.

Here is the code I use for computing the Earth position and velocity from the Moon and EMB position and velocity. The variables emb and moon are arrays containing the x,y,z postion and dx,dy,dz velocity (in that order).

    def getEarthPositionFromEMB(emb,moon):
earthMoonRatio=Decimal(0.813005600000000044E+02)
earth=[0,0,0,0,0,0]
for i in range(6):
earth[i]=emb[i]-moon[i]/(Decimal(1)+earthMoonRatio)
return earth

• The full code is here: github.com/gmiller123456/jpl-development-ephemeris/blob/master/… Mar 2, 2022 at 21:13
• Where did you get that Earth/Moon mass ratio? It's slightly low compared to the value I get from dividing the GM values given in Horizons body data files, 81.30056908. BTW, it's better to initialize Decimals with a string or int. If you initialize with a float, the value will contain spurious digits from the decimal to binary conversion performed at float precision (53 bits). See docs.python.org/3/library/decimal.html#decimal.Decimal Mar 3, 2022 at 1:38
• Horizons uses DE441 & DE440. You can get the Horizons news file by giving a body name of news in that body data script. OTOH, the values given in the body data files aren't from the DE, so your values from the DE file headers are possibly better. ;) FWIW, here's the script I used for the mass ratio calculation. sagecell.sagemath.org/… Mar 3, 2022 at 2:08
• Yea, that value comes from DE405 which is what the code is written to compute, I guess I should make that a parameter. Mar 3, 2022 at 2:37
• The trailing 00000000044 at the end of the DE405 Earth-Moon mass ratio is an artifact of IEEE floating point. The value back then was 81.30056, period. Any more digits after that would not have been real. With multiple missions to the Moon since the 1997 release of DE405, including the two GRAIL satellites, the value now is better stated as 81.300568. All of the extra digits in the DE440 header are superfluous. Mar 3, 2022 at 8:51

The JPL Development Ephemerides provides the Earth-Moon mass ratio to several digits. (A handy and easy number to remember: The Moon's mass is about 0.0123 Earth masses. This is low accuracy, but easy to remember.)

The combination of the vector from the solar system barycenter to the Earth-Moon barycenter, the vector from the Earth to the Moon, the Earth-Moon mass ratio, and (for example) a vector from the solar system barycenter to another point in the solar system enables one to compute the vector from the Earth to that other point in the solar system.

• I understand how to use the Earth-Moon ratio (nice mnemonics by the way!) to calculate the position of Earth and from there the Earth-centered position of coordinates in the solar system. However, I am unsure about how to calculate the velocity of Earth. This is because, if I understand correctly, by calculating the derivative of the Chebyshev sum for the EMB, we actually get the velocity of the EMB, not of Earth. Or did I miss something?
– Rafa
Mar 2, 2022 at 18:15
• In fact this document seems to state that the same relationship that applies to positions (R_earth = R_earthmoon - EMRAT1 * R_moon), also applies directly to velocities (VR_earth = VR_earthmoon - EMRAT1 * VR_moon). Interesting! I thought the calculation for velocity would be somehow different than for positions
– Rafa
Mar 2, 2022 at 18:49
• Actually, that value is pretty good, since the next few digits are zeroes. Using Horizons data, I get 0.01230003690 Mar 3, 2022 at 2:12
• @Rafa Unless you want to go full-bore general relativistic, it is as simple as that. JPL's velocities are full-bore general relativistic, so you might need to be careful about time scales. JPL uses its own home-brewed relativistic time scale $T_\text{eph}$, which is essentially the same as Barycentric Dynamic Time (TDB). Mar 3, 2022 at 9:11
• @PM2Ring That's why I like that value (0.0123). It's so easy to remember and it is good to six places of precision. The Moon-Earth mass ratio is known to about eight places, which is why I wrote "low accuracy". Mar 3, 2022 at 11:24

If you're using SPICE, you can directly have Earth's Chebyshev coefficients from bsp files. The SPICE "brief" utility allows you to display the contents of an SPK bsp file.

Example with de440.bsp file, available bodies are :

BRIEF -- Version 4.1.0, September 17, 2021 -- Toolkit Version N0067
Summary for: de440.bsp

Bodies: MERCURY BARYCENTER (1)  SATURN BARYCENTER (6)   MERCURY (199)
VENUS BARYCENTER (2)    URANUS BARYCENTER (7)   VENUS (299)
EARTH BARYCENTER (3)    NEPTUNE BARYCENTER (8)  MOON (301)
MARS BARYCENTER (4)     PLUTO BARYCENTER (9)    EARTH (399)
JUPITER BARYCENTER (5)  SUN (10)
Start of Interval (ET)              End of Interval (ET)
-----------------------------       -----------------------------
1549 DEC 31 00:00:00.000            2650 JAN 25 00:00:00.000


You can then extract Earth's Chebyshev coefficients and compute derivative to get velocities. I wrote a CSPICE algorithm to extract Chebyshev coefficients of a particular body if you are interested.

• Thanks for your answer! Do you have by any chance a source confirming that indeed bsp files contain Chebyshev coefficients for Earth directly, and not for the EMB? Welcome to Astronomy SE!
– Rafa
Mar 16, 2022 at 0:55
• Yes it's in the link I gave just above SPK bsp file slide 35. Mar 16, 2022 at 8:24
• I also checked by myself that we found the position of the Earth directly with these coefficients by comparing with Horizons. Note that each bsp file can contain different information, the "brief" command that I gave above allows you to display the content. Mar 16, 2022 at 8:32
• Interesting! It seems the binary versions of the ephemerides (.bsp files) contain Chebyshev coefficients for Earth directly as well (this is confusingly documented; I have not found a documentation as good as for the ASCII version), but not for Moon libration angles, for example, which are indeed present in the ASCII versions...
– Rafa
Mar 16, 2022 at 9:14
• Yes SPK bsp files are not containing sames datas as ASCII versions. I have found an other documentation of datas in bsp files. For the Moon libration angle I think you can use PCK kernel which gives orientation of the Earth and Moon. Mar 16, 2022 at 10:21