File:LagrangianPoints.gif

Summary

Description
English: Dynamics of test masses places near the 5 Lagrangian points, showing that L4 and L5 are stable, while the other aren't (the mass ratio between the two big masses is 40). Shown in both the inertial and the rotating frame.
Date
Source https://twitter.com/j_bertolotti/status/1256941485360140290
Author Jacopo Bertolotti
Permission
(Reusing this file)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 12.0 code

sunMass = 40`20;
planetMass = 1`20;
totalMass = sunMass + planetMass;
\[CapitalDelta]r = 6`20;
planetPos = {sunMass/totalMass \[CapitalDelta]r, 0};
sunPos = {-(planetMass/totalMass) \[CapitalDelta]r, 0};
\[Omega] = Sqrt[totalMass/\[CapitalDelta]r^3];
eq = FullSimplify[
   sunMass (sunPos - {x, y})/Norm[sunPos - {x, y} ]^3 + planetMass (planetPos - {x, y})/Norm[planetPos - {x, y}]^3 + \[Omega]^2 {x, y}, {x \[Element] Reals, y \[Element] Reals}];
Lp = {x, y} /. NSolve[eq == {0, 0}, {x, y}]

tmax = 500;
eq2 = FullSimplify[
   sunMass (sunPos - {x[t], y[t]})/Norm[sunPos - {x[t], y[t]} ]^3 + planetMass (planetPos - {x[t], y[t]})/Norm[planetPos - {x[t], y[t]}]^3 + \[Omega]^2 {x[t], y[t]} - 2 Cross[{0, 0, \[Omega]}, Join[D[{x[t], y[t]}, {t, 1}], {0}]][[1 ;; 2]], {x[t] \[Element] Reals, y[t] \[Element] Reals}];
nLp = Dimensions[Lp][[1]];
extrasat = 
  Partition[Flatten[Table[(# + Lp[[j]]) & /@ RandomReal[{-0.0025, 0.0025}, {20, 2}], {j, 1, nLp}]], 2];
nextra = Dimensions[extrasat][[1]]

sol = Table[
   NDSolve[{D[{x[t], y[t]}, {t, 2}] == eq2, x[0] == extrasat[[j, 1]], y[0] == extrasat[[j, 2]], x'[0] == 0, y'[0] == 0}, {x, y}, {t, 0,tmax}, WorkingPrecision -> 19, MaxSteps -> 10^6], {j, 1, nextra}];

p0 = Table[
   GraphicsRow[{
     Graphics[{
       Yellow, Disk[RotationMatrix[\[Omega] t].sunPos, 0.5], Disk[RotationMatrix[\[Omega] t].planetPos, 0.3],
       Red,
       Table[
        Disk[RotationMatrix[\[Omega] t].Lp[[j]], 0.05], {j, 1, 5}],
       Text[Style["L4", Bold], RotationMatrix[\[Omega] t].Lp[[1]] + {0.4, 0.4} ],
       Text[Style["L2", Bold], RotationMatrix[\[Omega] t].Lp[[2]] + {0.4, 0.4} ],
       Text[Style["L3", Bold], RotationMatrix[\[Omega] t].Lp[[3]] + {0.4, 0.4} ],
       Text[Style["L5", Bold], RotationMatrix[\[Omega] t].Lp[[4]] + {0.4, 0.4} ],
       Text[Style["L1", Bold], RotationMatrix[\[Omega] t].Lp[[5]] + {0.4, 0.4} ],
       Opacity[0.5], LightGray,
       Table[
        Disk[RotationMatrix[\[Omega] t].Evaluate[{x[t], y[t]} /. sol[[j]][[1]] ], 0.1], {j, 1, nextra}]
       }, Background -> Black, PlotRange -> {{-10, 10}, {-10, 10}}, 
      PlotLabel -> "Inertial frame", LabelStyle -> {Bold, White}]
     ,
     Graphics[{
       Yellow, Disk[sunPos, 0.5], Disk[planetPos, 0.3],
       Red,
       Table[Disk[Lp[[j]], 0.05], {j, 1, 5}],
       Text[Style["L4", Bold], Lp[[1]] + {0.4, 0.4} ],
       Text[Style["L2", Bold], Lp[[2]] + {0.4, 0.4} ],
       Text[Style["L3", Bold], Lp[[3]] + {0.4, 0.4} ],
       Text[Style["L5", Bold], Lp[[4]] + {0.4, 0.4} ],
       Text[Style["L1", Bold], Lp[[5]] + {0.4, 0.4} ],
       Opacity[0.5], LightGray,
       Table[
        Disk[Evaluate[{x[t], y[t]} /. sol[[j]][[1]] ], 0.1], {j, 1, nextra}]
       }, Background -> Black, PlotRange -> {{-10, 10}, {-10, 10}}, 
      PlotLabel -> "Rotating frame", LabelStyle -> {Bold, White}]
     }]
   , {t, 0, 100, 0.1}];
ListAnimate[p0]

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#LagrangianPoints.gif
Category:Self-published work Category:Lagrange points Category:Animations of astronomy Category:Images with Mathematica source code Category:Animated GIF files exceeding the 100 MP limit Category:Animated GIF files
Category:Animated GIF files Category:Animated GIF files exceeding the 100 MP limit Category:Animations of astronomy Category:CC-Zero Category:Images with Mathematica source code Category:Lagrange points Category:Pages using deprecated source tags Category:Self-published work