# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Compute properties for the Lagrange points of two orbiting astronomical bodies

Contributed by:
Jeff Bryant

ResourceFunction["LagrangePointData"][{ compute the value of | |

ResourceFunction["LagrangePointData"][{ compute the value of |

Computations are done in a coordinate system that rotates with the two primary bodies as they orbit.

In the coordinate system used, the origin is at the center of mass of the system and the orbiting bodies orbit in the *x*‐*y* plane with the *z*‐axis perpendicular to that plane.

The positive *x*‐direction is in the direction of the smaller mass.

The positive *y*‐direction follows a right‐hand rule convention.

The gravitational effective potential includes terms for the masses of the two bodies in addition to a centripetal term due to the orbital motion.

The distance between the two bodies changes with time, scaling the numbers accordingly.

For a given date, the gravitational effective potential assumes a circular orbit of *entity*_{1} and *entity*_{2} using the distance on that date (*a*) as the distance between the bodies.

The following keys can be seen in the results:

q | the mass ratio, M_{secondary}/M_{primary} |

μ | the reduced mass,M_{secondary}/(M_{primary} + M_{secondary}) |

a | the distance between entity_{1} and entity_{2} |

ω | the angular velocity of the orbit |

The "NondimensionalizedPotential" sub‐value of the "GravitationalEffectivePotentialData" property uses SI base units.

The *property* can be any of the following:

"ContourPlot" | contour plot of the gravitational effective potential |

"ContourPlot3D" | 3D contour plot of the gravitational effective potential |

"Distances" | dataset of distances between the bodies and the Lagrange points |

"GravitationalEffectivePotentialData" | association of data related to the gravitational effective potential |

"Plot3D" | 3D surface plot of the gravitational effective potential |

Options supported by LagrangePointData include:

"EmphasizeSecondaryMassRegion" | False | whether or not to zoom into the area near the secondary mass |

TargetUnits | Automatic | units to use only when requesting distances |

Additional options vary depending on the property requested ("ContourPlot" supports all the options of ContourPlot, etc.).

The potential (*V*) can be used to formulate the position and speed of a third body in the system using the following equations of motion: *x*''-2*ω**y*'==-∂*V*/∂*x*, *y*''+2*ω**x*'==-∂*V*/∂*y*.

Compute data about the gravitational effective potential:

In[1]:= |

Out[1]= |

Find the gravitational effective potential at a specific 3D point:

In[2]:= |

Out[2]= |

Create a contour plot of the gravitational effective potential:

In[3]:= |

Out[3]= |

Create a 3D surface plot of the gravitational effective potential:

In[4]:= |

Out[4]= |

Create a 3D contour plot of the gravitational effective potential:

In[5]:= |

Out[5]= |

Compute the current distance between both bodies and the various Lagrange points:

In[6]:= |

Out[6]= |

Compute the distance between both bodies and the various Lagrange points on a specified date:

In[7]:= |

Out[7]= |

Create a contour plot with distances:

In[8]:= |

Out[8]= |

Emphasize the area around the secondary mass as 2D contours:

In[9]:= |

Out[9]= |

Emphasize the area around the secondary mass as a 3D surface:

In[10]:= |

Out[10]= |

Emphasize the area around the secondary mass as 3D contours:

In[11]:= |

Out[11]= |

Specify the distance to the Lagrange points in specific units:

In[12]:= |

Out[12]= |

Plot the equipotential through a specific Lagrange point:

In[13]:= |

Out[13]= |

Compute the distances of the bodies to the L1 point of the Earth-Moon system:

In[14]:= |

Out[14]= |

Compute the distance of the Earth to the L1 point of the Earth-Moon system:

In[15]:= |

Out[15]= |

Compute the distance between the Moon and the L1 point of the Earth-Moon system:

In[16]:= |

Out[16]= |

Compute the distance between Earth and the Moon:

In[17]:= |

Out[17]= |

If the two bodies don't orbit each other, then computations are not applicable:

In[18]:= |

Out[18]= |

Explore the Lagrange points of the Sun‐Jupiter system:

In[19]:= |

Solve the equations of motion for a particle starting at the L1 point and moving in the -*x*‐direction and -*y*‐direction over a period of about 31 years (1,000,000,000 seconds):

In[20]:= |

Solve the equations of motion for particle starting near the L4 and L5 points with different initial velocities:

In[21]:= |

In[22]:= |

In[23]:= |

In[24]:= |

In[25]:= |

In[26]:= |

Out[26]= |

The motion around L4 and L5 is stable if *μ*^{2}>23/27.

Explore the space of possible orbits of a test particle starting near L4:

In[27]:= |

Out[27]= |

Wolfram Language 13.0 (December 2021) or above

This work is licensed under a Creative Commons Attribution 4.0 International License