Solving the Three Body Problem With Python
Yes, it’s time for the famous Three Body Problem. How do you model the motion of three objects interacting gravitational (those are the 3 bodies)? Well, let’s jump back for a second. How do you model just TWO objects with a gravitational interaction?
The Two Body Problem
Here are two planets (or stars — it doesn’t matter, you pick).
With the vector from planet A to B (r_AB), I can calculate the gravitational force on B as:
Just to be clear, I’m using notation that F_AB is the force ON B due to A. With that, the force on A (due to B) is just the negative of this vector. Now, let’s say that we break this planet motion into “short” time intervals (Δt) — and by “short” I mean that it’s short enough that we can approximate the forces as being constant during this time. Depending on the initial conditions this time interval could be as short as a minute or maybe as long as an hour (or more even).
Suppose planet B starts with a momentum p_B1. Since we know the force acting on it (and assuming this force is constant) we can use the momentum principle to find the momentum at the end of the time…