Poincaré’s 3 bodies problem

The equations of gravitation applied to the movement of 3 bodies in two dimensions. The positions of the bodies are (x1,y1), (x2,y2), (x3,y3) and their respective masses m1, m2 and m3. The gravitation constant is G. In 3-dimensions, there are 18 equations: 6 for each body. Here, in dimension 2 we consider 12 equations, 4 for each body.

# 3 bodies’s problem

l12=((x1-x2)^2+(y1-y2)^2)^(3/2)

l13=((x1-x3)^2+(y1-y3)^2)^(3/2)

l23=((x2-x3)^2+(y2-y3)^2)^(3/2)

x1'=x1p

x1p'=G*m2/l12*(x2-x1)+G*m3/l13*(x3-x1)

x2'=x2p

x2p'=G*m1/l12*(x1-x2)+G*m3/l23*(x3-x2)

x3'=x3p

x3p'=G*m1/l13*(x1-x3)+G*m2/l23*(x2-x3)

y1'=y1p

y1p'=G*m2/l12*(y2-y1)+G*m3/l13*(y3-y1)

y2'=y2p

y2p'=G*m1/l12*(y1-y2)+G*m3/l23*(y3-y2)

y3'=y3p

y3p'=G*m1/l13*(y1-y3)+G*m2/l23*(y2-y3)

param m1=5e-4, m2=5e-4, m3=100, G=67

param scale=0.01, scale1=1, scale2=1, scale3=3

init x1=10, x2=20, y1p=20, y2p=10

@ BOUNDS=10000

@ DT=0.01

done

Here we consider three bodies with similar masses that interact under gravity. This interaction can produce strong accelerations. In fact, this principle is used to accelerate or desaccelerate spatial ships using the gravity of planets or moons.

As in the solar system, we consider here a massive body (in red) and two planets (in yellow and green). The diameters of the balls are only for graphic purposes and not in scale. We observe the ellipsoidal orbits studied by Kepler.

In fact, with this numerical simulations it is possible to obtain the three laws of Kepler.