next up previous contents
Next: 5.3 Setting up Three Up: 5. Exploring with a Previous: 5.1 A More General

5.2 Coordinates in the Center of Mass System

Unlike the two-body case, there is no gain in simplicity if we would use relative coordinates for the $N$-body system in general. For two bodies, there is only one set of relative coordinates, while there are two sets of particle coordinates, one for each particle. For three bodies, there are three combinations of separations between individual particles, just as there are three sets of particle coordinates. In that case, it is a matter of taste which one one prefers to use. For all higher values of $N$, the number of relative separations is always larger than the number of particles (six versus four for $N=4$, for example). In conclusion, from $N=3$ onward, it makes more sense to define the positions and velocities with respect to a given coordinate system.

Although not necessary, it is often convenient to use the center of mass system for our orbit calculations. The center of mass is defined in any coordinate system as

{\bf R}= \frac{1}{M} \sum_{i=1}^N m_i{\bf r}_i
\end{displaymath} (5.3)

where $N$ is the total number of particles, $m_i$ and ${\bf r}_i$ are the mass and the position of particle $i$, and $M=\sum_{i=1}^N m_i$ is the total mass of the system. We can interpret the right hand side as a type of lever arm equation. In a one-dimensional system of weights hanging from a beam in the Earth's gravitational field, the left and right parts of the beam will be in equilibrium if we support the beam exactly at the center of mass. The same is true for a two-dimensional plank with masses.

With three dimensions, we have no room left in an extra dimension for external support, but an analogous result still holds: the motion of the center of mass is the same as if the entire mass of the system was concentrated there and acted upon by the resultant of all external forces. See any textbook on classical dynamics for a derivation of this property. In the case of an isolated $N$-body system, there are no external forces, and therefore the center of mass will move in a straight line.

Starting with a given coordinate system, and subtracting the center of mass position vector ${\bf R}$ from all particle positions allows us to construct a representation of the $N$-body system in its c.o.m. system (a short hand for `center of mass'). Subtracting the c.o.m. position is not enough, however. While this causes a momentary centering, it is still quite possible that the $N$-body will start drifting off soon thereafter. To keep the system in place, at least on average, we also have to subtract the velocity of the c.o.m. ${\bf V}$ from all particle velocities. Differentiation of Eq. 5.3 gives:

{\bf V}= \frac{1}{M} \sum_{i=1}^N m_i{\bf v}_i
\end{displaymath} (5.4)

This shows, incidentally, that the total momentum of all particles is zero in the c.o.m. coordinate system. Since the c.o.m. moves in a straight line, no further corrections are necessary. Throughout this book, when we set up initial conditions for an $N$-body system, we will do so in the c.o.m. of that system.

At the beginning of our code, we see how positions, velocities, and accelerations are now represented by two-dimensional arrays, where the first counter indicates the number of the particle in an $N$-body system, and the second counter the Cartesian coordinate. Note that in C++ array counters start at zero. Therefore, the $y$ component of the position of the 3rd particle is not stored in a[3][2] as one might naively think, but rather in a[2][1]. In a 3-body system such as the one coded here, the value a[3][2] is in fact undefined, since it lies outside the memory area assigned to the area; using that value would present a serious bug.

next up previous contents
Next: 5.3 Setting up Three Up: 5. Exploring with a Previous: 5.1 A More General
Jun Makino