Introduction to n-Body problem
Lots of post on this site begin with an appeal to Newtons second law. It’s an extremely useful tool for analyzing dynamic systems. This post wont begin this way. It’ll begin with Newtons third law.
“For every action there is an equal and opposite reaction”
This means that anytime a force acts on an object, an equal and opposite force acts on the object causing the force. If you lift up a ball an inch or two and let it fall it is pulled back down by the earths gravitational force. If you lift your arm up you can feel a force pulling your arm, like the ball down. That force pulling on your arm, isn’t the only force. From Newtons third law we know that there’s a second force. It’s acting on the earth and its magnitude is equal to the force acting on you, but it is opposite in direction. There’s also a third force from mars and a fourth from Jupiter, etc. Because we are so close to Earth, its gravitational pull is so much larger than the rest, but all objects with mass provide a small but real force on you. In conjunction to newtons third law, you also exert a force on every object with mass in the universe. (Note: Gravity only propagates at the speed of light but take a moment to forget that and feel connected to the universe)
Now that we’ve waxed poetic for a paragraph, lets get to what is the n-body problem? It’s simply the problem of how to describe the motion of a number, n, different objects interacting with each other gravitationally. An example of this would be our solar system. If we wanted to map out the movement of the moon with respect to an initially fixed sun we would need to take into account the relative positions of the sun, the moon, and the earth and the gravitational forces they cause on each other. Because we are taking into account 3 objects, this would be called a 3-body problem. (Note there is a great sci-fi book with the name The 3-Body Problem that I highly recommend). If we wanted to predict the moon’s motion with more accuracy, we could take into account the forces from Mars, Jupiter, Venus, and Neptune. This would turn it into a 7-body problem.
We have an analytical solution to the 2-body problem. We have solutions to several restricted 3-body problems, but no general analytic solution. The search for analytical solutions to the n-body problem has led to many modern mathematical advances. It has been worked on by some of the best minds in the field like Euler, Newton, and Gauss, and is still an active research topic.
Basic Governing Equations Behind it
The magnitude of gravitation force between two objects can be described as
Here m1 is the mass of the first object and m2 is the mass of the second object. G is the universal gravitational constant, and r is the distance between the two objects.
There are two interesting characteristics of this equation. The first is that the distance portion is quadratic. If you halve the distance between two objects, the force between them quadruples. The second, is that there is a singularity when there is no distance between the two bodies. We’ll end up having to deal with that problem later.
Now that we have the magnitude, let’s incorporate a term for direction. For this we need to know the relative positions of the the two particles as a unit-normal vector. Unit here just means it’s magnitude is one.
Two notes on convention: the four vertical lines represent the two norm of a number and the bold symbol represent a vector.
Note on vectors: If we have the position of the two particles on a coordinate system, how do we get their relative position? Looking at the diagram to the right we have two particles, P1 and P2. We also have r1 and r2 and want to get r.
We label it r21 because it goes from particle 2 to particle 1
Now if we want to describe how to go from particle 1 to particle 2 all we need to do is flip the terms and we get
With this new information mean we can again rewrite Newton’s law of gravitation acting on point 1 from point 2 as
\
Now, by applying to newtons second law, describing the governing equations behind the n-body problem is quite simple.
Simulating the Sysyem
To simulate the N-body problem, lets turn to trusty old MatLab. I’m gonna use ODE45 and numerically integrate the equations forward. In order to do this I need to provide an initial starting position and velocity states, which I chose at random. Above we can see a simulation of a 10 body system evolving over 100 seconds. To visualize it I used a comet plot, which is where the current position is shown as a circle and a subset of past positions is shown as a line. These plots are extremely useful to visualize change over time if you want to track movement.
To the right you can see the paths that all 10 bodies traced out durring their entire 100 second path. We can easily see how the simple governing equations from above came together to form an extremely complex dynamic system.
Trouble Shooting the Simulation
Now if your remember from earlier, there is a singularity when the two bodies are right on top of each other. Most of the time this is solved by having bodies that come within a certain range collide and either merge together or bounce off each other. In my case, just for the sake of simplicity I modified newtons law of gravitational attraction to the following.
This makes it so that as the norm or r goes to zero the denominator goes to .00001 which removes the singularity.
Seeing Things from a Different Point of View.
To the right we can see another 8 body system from an inertial viewpoint. Below we have the same 8 body system that the graph to the right shows, but from two different viewpoints. Instead of being fixed in space and letting the bodies evolve over time, we fix our viewpoints on a single body and observe the rest of the bodies evolve over time. They both describe the same system, but look completely different because our viewpoints are evolving over time. Without the title it would be easy to mistake them for two different systems.
What this series will entail
Now this will not be a stand alone post. It’s the start of a series called the n-body problem. I will start with the most simple of these problems, where n is equal to 2, and work my way up exploring different concepts and branching off on tangents that I find interesting and the mathematical advances these problems helps spur. While the name says n-body problem and we’ll be using it as a muse for the posts the main thrust of this course will be to cover astrodynamics. I’m beginning my PhD in satellite trajectory design this coming fall and to prepare for it I will be going through Richard Battin’s Introduction to Astrodynamics. It is a tome filled with knowledge, and I hope to explore it in a new, more interactive medium. Quite a lot of the concepts in astrodynamics are geometric in nature and animated gifs are just not possible in a book. Additional I may look at developing jupyter notebooks on orbital dynamics so that you may interact with them and gain a more intuitive understanding of a topic that I think is really damn cool. If you want to get these, and all the other posts from Gereshes, delivered directly to your email when they come out every Monday, there’s an email signup here.
If you can’t wait for next weeks post and want some more Gereshes I suggest
Rollout of a rocket motor test stand
How to pump a swing using math