If you can convert arbitrary (geocentric or heliocentric) position vectors into RA/DEC, the solution is straightforward, as you can compute the position vectors of the Lagrange points relatively easily.
If you have the geocentric position vector of the Sun, Rsun
, you can do the following:
Since L1, L2 and L3 are on the Sun-Earth line, they are just differently scaled versions of Rsun
. Here are some pretty good approximations that work because the mass of the Sun is much bigger than the mass of the Earth (the exact formulas are much more complicated):
L1 = Rsun * (m / (3*M))**(1/3)
L2 = -Rsun * (m / (3*M))**(1/3)
L3 = Rsun * (2 + (5*m / (12*M))
where the mass units don't matter so we can use Earth mass as the unit so that m == 1
is the Earth's mass and M == 333000
is the Sun's mass.
The L4 and L5 points are corners of equilateral triangles with the Sun and the Earth. Therefore you can get them by rotating Rsun
by 60° and –60° around the normal of the orbital plane (usually the z-axis in an ecliptical coordinate system). This is easy, the pseudocode is:
# Get the three components of the original vector
x,y,z = Rsun
# Compute the rotated vector
L4 = [
x * cos(60°) - y * sin(60°),
x * sin(60°) + y * cos(60°),
z
]