<p>The book &quot;Astronomical Algorithms&quot; teaches a way to calculate the position of any of the planets for almost any date, until you get to Pluto.</p>
<p>To try to get around that, I attempted to convert the heliocentric coordinates to geocentric, but my formula only gets me so close to the actual geocentric longitude, leaving me with a number that is around 22 minutes off most of the time. Sure I could just add that number and have a very good program that has a ~3 min error margin, but that's too little accuracy for what I'm trying to build. At least the minutes must be accurate.</p>
<p>Here's my py code using astropy. I'm using it to try to learn to make the conversion from heliocentric to geocentric. There's also another problem that the book only teaches me how to get heliocentric coordinates without corrections, which isn't the case here with the py program...</p>
<pre><code>    from astropy.coordinates import SkyCoord, solar_system_ephemeris, get_body_barycentric_posvel, HeliocentricTrueEcliptic
from astropy.time import Time
import numpy as np
import math

date = Time(&quot;2024-04-06&quot;)

with solar_system_ephemeris.set('de432s'):
    earth_pos, earth_vel = get_body_barycentric_posvel('earth', date)
    pluto_pos, pluto_vel = get_body_barycentric_posvel('pluto', date)
    
    earth_coord = SkyCoord(earth_pos, obstime=date, frame='icrs')
    pluto_coord = SkyCoord(pluto_pos, obstime=date, frame='icrs')

    earth_ecliptic = earth_coord.transform_to(HeliocentricTrueEcliptic(obstime=date))
    pluto_ecliptic = pluto_coord.transform_to(HeliocentricTrueEcliptic(obstime=date))

    earth_l, earth_b, earth_r = earth_ecliptic.lon.radian, earth_ecliptic.lat.radian, earth_ecliptic.distance.au
    pluto_l, pluto_b, pluto_r = pluto_ecliptic.lon.radian, pluto_ecliptic.lat.radian, pluto_ecliptic.distance.au

    earth_x = earth_r * np.cos(earth_b) * np.cos(earth_l)
    earth_y = earth_r * np.cos(earth_b) * np.sin(earth_l)
    earth_z = earth_r * np.sin(earth_b)
    
    pluto_x = pluto_r * np.cos(pluto_b) * np.cos(pluto_l)
    pluto_y = pluto_r * np.cos(pluto_b) * np.sin(pluto_l)
    pluto_z = pluto_r * np.sin(pluto_b)

    pluto_geocentric_x = pluto_x - earth_x
    pluto_geocentric_y = pluto_y - earth_y
    pluto_geocentric_z = pluto_z - earth_z

    pluto_geocentric_longitude = np.arctan2(pluto_geocentric_y, pluto_geocentric_x)
    pluto_geocentric_longitude_degrees = np.degrees(pluto_geocentric_longitude)

    if pluto_geocentric_longitude_degrees &lt; 0:
        pluto_geocentric_longitude_degrees += 360

print(&quot;Pluto's geocentric longitude (in degrees):&quot;, pluto_geocentric_longitude_degrees)
</code></pre>

CC BY-SA 4.0
2024-04-07T14:44:06.370Z
What are you comparing your sesults to?
Greg Miller
CC BY-SA 4.0
2024-04-07T16:41:48.640Z
@GregMiller I'm using the JPL Horizons System

 2024-Apr-08 00:00 *m  20 18 18.60 -22 41 00.0     n.a.    n.a.  35.2055834571178 -27.2369659   76.7060 /L    1.5954  301.9587961  -2.9620390         n.a.   0.0302675   90.032309   -64.69034         n.a.     n.a.

Here it gives me the accurate geocentric position of pluto for today 301.958796, but my results using the py program I posted here are 301.5957303560813

I'm looking for an algorithm or fomula to derive this same result
Matheus Azevedo
CC BY-SA 4.0
2024-04-07T17:23:55.227Z
The name of the column where that info is available is ObsEcLon. I have to change the settings to display observer ecliptic longitude and latitude

https://ssd.jpl.nasa.gov/horizons/app.html#/
Matheus Azevedo
CC BY-SA 4.0
2024-04-07T19:40:39.697Z
Documentation for Horizons says the ecliptic used for non earth satellites is the J2000 ecliptic.  Above you have converted to the ecliptic of date.  Other alterations to the position also include light time, gravitational deflection, and stellar aberration, and optionally atmospheric refraction.  The ecliptic of date is the largest error, the others might add up to about 10-30 arcseconds.
Greg Miller
CC BY-SA 4.0
2024-04-11T16:34:27.603Z
@GregMiller Thank you very much! I corrected my calculations as you suggested and it worked.

I didn't correct for nutation, but what I got was close enough for me. I've been trying to post the code here in the comments, but it's too long. I'm not sure if I should answer my own question with the complete new working code, but all I did was correct it for the ecliptic and add the value to the ecliptic longitude of Pluto.

$$\Delta \lambda = (1.396971 \times d + 0.000308 \times d^2)$$

$$\text{Corrected Longitude} = \text{Original Longitude} + \Delta \lambda + \text{Nutation Correction}$$
Matheus Azevedo
CC BY-SA 4.0
2024-04-11T16:44:08.637Z
and d is

`delta_days = current_julian_date - 2000_JULIAN_DATE`
    
`d = delta_days / DAYS_PER_CENTURY`

I didn't correct for nutation, but the result was close enough
Matheus Azevedo
CC BY-SA 4.0
2024-04-11T20:02:17.910Z
Self answering your own question is a well accepted thing.  Certainly much better than unanswered.
Greg Miller
CC BY-SA 4.0
2024-04-11T23:31:17.183Z
@MatheusAzevedo oh it's absolutely great if you found a solution that you write it up as an answer. Stack Exchange is not a competition - it's all about generating answers and solving problems, and what better news than you've solved your problem! *Go for it!*
uhoh
<planet><solar-system><positional-astronomy><pluto>
How can I calculate the geocentric longitude of Pluto in a similar way to VSOP87's algorithm?
Matheus Azevedo
# How can I calculate the geocentric longitude of Pluto in a similar way to VSOP87's algorithm?

(Asked by: username_0 on 2024-04-07)

The book "Astronomical Algorithms" teaches a way to calculate the position of any of the planets for almost any date, until you get to Pluto.
To try to get around that, I attempted to convert the heliocentric coordinates to geocentric, but my formula only gets me so close to the actual geocentric longitude, leaving me with a number that is around 22 minutes off most of the time. Sure I could just add that number and have a very good program that has a ~3 min error margin, but that's too little accuracy for what I'm trying to build. At least the minutes must be accurate.
Here's my py code using astropy. I'm using it to try to learn to make the conversion from heliocentric to geocentric. There's also another problem that the book only teaches me how to get heliocentric coordinates without corrections, which isn't the case here with the py program...
    from astropy.coordinates import SkyCoord, solar_system_ephemeris, get_body_barycentric_posvel, HeliocentricTrueEcliptic
from astropy.time import Time
import numpy as np
import math

date = Time("2024-04-06")

with solar_system_ephemeris.set('de432s'):
    earth_pos, earth_vel = get_body_barycentric_posvel('earth', date)
    pluto_pos, pluto_vel = get_body_barycentric_posvel('pluto', date)
    
    earth_coord = SkyCoord(earth_pos, obstime=date, frame='icrs')
    pluto_coord = SkyCoord(pluto_pos, obstime=date, frame='icrs')

    earth_ecliptic = earth_coord.transform_to(HeliocentricTrueEcliptic(obstime=date))
    pluto_ecliptic = pluto_coord.transform_to(HeliocentricTrueEcliptic(obstime=date))

    earth_l, earth_b, earth_r = earth_ecliptic.lon.radian, earth_ecliptic.lat.radian, earth_ecliptic.distance.au
    pluto_l, pluto_b, pluto_r = pluto_ecliptic.lon.radian, pluto_ecliptic.lat.radian, pluto_ecliptic.distance.au

    earth_x = earth_r * np.cos(earth_b) * np.cos(earth_l)
    earth_y = earth_r * np.cos(earth_b) * np.sin(earth_l)
    earth_z = earth_r * np.sin(earth_b)
    
    pluto_x = pluto_r * np.cos(pluto_b) * np.cos(pluto_l)
    pluto_y = pluto_r * np.cos(pluto_b) * np.sin(pluto_l)
    pluto_z = pluto_r * np.sin(pluto_b)

    pluto_geocentric_x = pluto_x - earth_x
    pluto_geocentric_y = pluto_y - earth_y
    pluto_geocentric_z = pluto_z - earth_z

    pluto_geocentric_longitude = np.arctan2(pluto_geocentric_y, pluto_geocentric_x)
    pluto_geocentric_longitude_degrees = np.degrees(pluto_geocentric_longitude)

    if pluto_geocentric_longitude_degrees < 0:
        pluto_geocentric_longitude_degrees += 360

print("Pluto's geocentric longitude (in degrees):", pluto_geocentric_longitude_degrees)

**Tags:** planet, solar-system, positional-astronomy, pluto
> **Comments:**
> **username_1**: What are you comparing your sesults to?  
> **username_0**: @GregMiller I'm using the JPL Horizons System   2024-Apr-08 00:00 *m  20 18 18.60 -22 41 00.0     n.a.    n.a.  35.2055834571178 -27.2369659   76.7060 /L    1.5954  301.9587961  -2.9620390         n.a.   0.0302675   90.032309   -64.69034         n.a.     n.a.  Here it gives me the accurate geocentric position of pluto for today 301.958796, but my results using the py program I posted here are 301.5957303560813  I'm looking for an algorithm or fomula to derive this same result  
> **username_0**: The name of the column where that info is available is ObsEcLon. I have to change the settings to display observer ecliptic longitude and latitude  https://ssd.jpl.nasa.gov/horizons/app.html#/  
> **username_1**: Documentation for Horizons says the ecliptic used for non earth satellites is the J2000 ecliptic.  Above you have converted to the ecliptic of date.  Other alterations to the position also include light time, gravitational deflection, and stellar aberration, and optionally atmospheric refraction.  The ecliptic of date is the largest error, the others might add up to about 10-30 arcseconds.  
> **username_0**: @GregMiller Thank you very much! I corrected my calculations as you suggested and it worked.  I didn't correct for nutation, but what I got was close enough for me. I've been trying to post the code here in the comments, but it's too long. I'm not sure if I should answer my own question with the complete new working code, but all I did was correct it for the ecliptic and add the value to the ecliptic longitude of Pluto.  $$\Delta \lambda = (1.396971 \times d + 0.000308 \times d^2)$$  $$\text{Corrected Longitude} = \text{Original Longitude} + \Delta \lambda + \text{Nutation Correction}$$  
> **username_0**: and d is  `delta_days = current_julian_date - 2000_JULIAN_DATE`      `d = delta_days / DAYS_PER_CENTURY`  I didn't correct for nutation, but the result was close enough  
> **username_1**: Self answering your own question is a well accepted thing.  Certainly much better than unanswered.  
> **username_2**: @MatheusAzevedo oh it's absolutely great if you found a solution that you write it up as an answer. Stack Exchange is not a competition - it's all about generating answers and solving problems, and what better news than you've solved your problem! *Go for it!*  

---

## 0 answers

