next up previous contents
Next: 3. Exploring with a Up: 2. Getting Started on Previous: 2.2 The Gravitational -Body

2.3 The Gravitational $2$-Body Problem

A decision was made to let Carol take the controls, for now. Taking the keyboard in front of a large computer screen, she opens a new file nbody.C in her favorite editor. Expectantly, she looks at Alice, sitting to her left, for instructions, but Bob first raises a hand.

Bob:
I'm a big believer in keeping things simple. Why not start by coding up the 2-body problem first, before indulging in more bodies? Also, I seem to remember from an introductory physics class for poets that the 2-body problem was solved, whatever that means.

Alice:
Good point. Let's do that. It is after all the simplest case that is nontrivial: a 1-body problem would involve a single particle that is just sitting there, or moving in a straight line with constant velocity, since there would be no other particles to disturb its orbit.

And yes, the 2-body problem can be solved analytically. That means that you can write a mathematical formula for the solution. For higher values of $N$, whether 3 or 4 or more, no such closed formulas are known, and we have no choice but to do numerical calculations in order to determine the orbits. For $N=2$, we have the luxury of being able to test the accuracy of our numerical calculations by comparing our results with the formula that Newton discovered for the 2-body problem.

Yet another reason to start with $N=2$ is that the description can be simplified. Instead of giving the absolute positions and velocities for each of the two particles, with respect to a given coordinate system, it is enough to deal with the relative positions and velocities. Instead of dealing with position ${\bf r}_1$ for the first particle and ${\bf r}_2$ for the second particle, we can write down the gravitational attraction between the two in terms of the relative position, defined as:


\begin{displaymath}
{\bf r}= {\bf r}_2 - {\bf r}_1
\end{displaymath} (2.1)

Newton's gravitational equation of motion then becomes:


\begin{displaymath}
\frac{d^2}{dt^2}{\bf r}= - G \frac{M_1 + M_2}{r^3}{\bf r}
\end{displaymath} (2.2)

This is a second-order differential equation. At the left-hand side you see the second derivative of position with respect to time $t$. The first time derivative of position ${\bf r}$ is the velocity ${\bf v}= d{\bf r}/dt$ while the second derivative presented here is the acceleration ${\bf a}= d{\bf v}/dt = d^2{\bf r}/dt^2 $. At the right hand side, the masses of the two particles are indicated by $M_1$ and $M_2$, respectively. $G$ is the value of Newton's gravitational constant.

I'm glad you both have at least some familiarity with differential equations, in the context of classical mechanics. It may not be a bad idea to brush up your knowledge, if you want to know more about the background of Newtonian gravity. There are certainly plenty of good introductory books. At this point it is not necessary, though, to go deep into all that. I can just provide the few equations we need to get started, and for quite a while our main challenge will be to figure out how to solve these equations.

Bob:
The differential equation does indeed look familiar, but why is there a power 3 in the denominator? I thought that Newtonian gravity is an inverse square power, so I would have expected a power 2 down there.

Alice:
Good question! We are working here in three dimensions, because that is how many dimensions space in the universe has. The bold-face notation ${\bf r}$ indicates that we are dealing with three-dimensional vectors. If we name the components as follows,


\begin{displaymath}
{\bf r}= \{x, y, z\}
\end{displaymath} (2.3)

then the scalar distance between the two particles is defined by


\begin{displaymath}
r = \vert {\bf r}\vert = \sqrt{x^2+y^2+z^2}
\end{displaymath} (2.4)

And while it is true that Newtonian gravity is a $1/r^2$ force, we have to tell the particles not only the magnitude of their mutual attraction, but also the direction in which they pull each other. This is accomplished by adding the last factor ${\bf r}$. To compensate for the fact that ${\bf r}$ grows linearly with the distance, we have to add an extra power in the denominator.

Carol:
Is there no cleaner way to write this equation, making the $1/r^2$ nature of the interaction more transparent?

Alice:
Sure there is. We can introduce a so-called unit vector, which by definition has a length of one unit in our coordinate system. This is a good tool for dealing with directions without introducing changes in magnitude. The unit vector corresponding to ${\bf r}$ is given as $ \hat{\bf r}= {\bf r}/ r $, and the equation of motion for our 2-body problem now reads:


\begin{displaymath}
\frac{d^2}{dt^2}{\bf r}= - G \frac{M_1 + M_2}{r^2}\hat{\bf r}
\end{displaymath} (2.5)

Bob:
That looks more like the real thing.

Carol:
Yes, but it may be easier to program the previous expression, so let's keep both on the table for now, and see what's most convenient.

Alice:
One more thing: let's make life as simple as we can, by choosing a system of physical units in which the gravitational constant and the total mass of the 2-body system are both unity:


$\displaystyle G$ $\textstyle =$ $\displaystyle 1$ (2.6)
$\displaystyle M_1 + M_2$ $\textstyle =$ $\displaystyle 1$ (2.7)

Our original equation of motion now becomes simply:


\begin{displaymath}
\frac{d^2}{dt^2}{\bf r}= - \frac{{\bf r}}{r^3}
\end{displaymath} (2.8)


next up previous contents
Next: 3. Exploring with a Up: 2. Getting Started on Previous: 2.2 The Gravitational -Body
The Art of Computational Science
2004/01/25