Gravitational slingshot

The following animated GIF shows the evolution of a three body system under the "planar circular restricted hypothesis". Namely, the green circles  are two large mases m1 and m2 with m2/(m1+m2)=0.29 orbiting in circles around the origin (of course the closer to the origin is the heavier one), the blue circle is the third body with a mass m3 negligible in comparison to m1 and m2. The red spot appearing all the time in the animation is the Lagrange point  L1. At some moment also L4 and L5 appear in the image. As you can see, the gravitational pull of m2 is employed to change completely the direction of the "probe" m3 putting it in orbit around m2. It is a gravity assist maneuver or gravitational slingshot.


To appreciate the change of the velocity, in the following picture they are plotted all frames together (without the Lagrange points). The regular separation of the green dots corresponds to constant angular velocity, as it has to be by Kepler's laws, on the other hand, the blue dots are accelerated (spaced) when approaching to m2.

A natural question is: What happens next? Does m3 orbit around m1 forever? The short answer is no. For the long answer, continue reading.
The time evolution is better explained using a rotating frame being its X axis the line  connecting m1 and m2. If you think that m2 has a rotational period that coincides with its orbital period, this is th natural frame employed by the observers in m1 and m2. If the animation lasts a time T, this is the plot in the rotating frame until approximately time 4T


The red dashed curve is the "zero velocity curve" coming from the unique conservation law in the circular restricted three body problem. The mass m3 cannot pass through it. In principle, it looks strange the tiny loop near the starting point. Recall that we are in a rotating system and we also observe retrograde loops when observing some planets from Earth. The plot shows that our probe can take pictures of m1 during three orbits before it is captured again by m2.

The same question here: What next? Things are really chaotic even in this special instance of the three body problem. This is the plot for 13.8T


Then m3 orbits three times around m2 but it is captured again by m1 and it comes back to m2 and  escapes through the small slit in the zero velocity curve. What next? Does some kind of ergodicity force m3 to re-enter through the slit? I do not know.

The code generating these plots is a Runge Kutta 4 method in C to generate the data. The code is launched by a sagemath program that also composes the frames. The GIF is obtained with the shell script

convert -delay $1 -loop 1 temp_frame*.png  -deconstruct -layers optimize $2.gif
rm temp_frame*.png
du -h $2.gif
You can download all the code from here. It is the folder named ./prog/section6.

If you want to try your own experiments the relevant data is that using units of mass and time such that the distance  between m1 and m2  and their angular velocity are 1, then the initial conditions for velocity and position of m3 in the rotating system (with origin in the center of mass) are x0=0.5427008, y0=-0.2574309,  vx0=-0.1441290, vy0=-0.5512641. Recall also that m2/(m1+m2)=0.29.

I have also composed a video with an apparently periodic solution for m2/(m1+m2)=0.002 that I found playing with the data. Note that the big mass in the center is also moving slightly.
For the video I used the script

# Comment 'rm temp_frame*.png' in animate and
# run 'make_animation(Lorb, Lnum, Lplo, 300, 25, 3)'
rm output1.mp4
ffmpeg -framerate 24 -start_number 0 -i temp_frame%03d.png output1.mp4
rm temp_playlist.txt
for i in {1..2}; do printf "file '%s'\n" output1.mp4 >> temp_playlist.txt; done
rm output.mp4
ffmpeg -f concat -i temp_playlist.txt  -c copy output.mp4
rm output1.mp4
echo '  '
du -h output.mp4
The 2 in the for loop indicates the number of repetitions of the video. Apparently one cannot loop a video forever with ffmpeg.