# 15.23 Gravity of Many Bodies

Newton's law of gravity expresses the attractive force between two objects separated by some distance. The equation is exact: if we know the two masses accurately, and the distance between them accurately, we can calculate the force accurately. The orbit of a binary star is a situation with an exact solution. However, if there are more than two objects close together in space, the gravity is no longer described by a single equation. A set of equations is required, and they no longer have an exact mathematical solution. Astronomers say that the definition of gravity in a set of three or more objects is a computational problem. In other words, the gravity force can be calculated using a powerful computer. Higher accuracy requires more computer power.

Astronomers can often make an important simplifying assumption about gravity. In the Solar System, the Sun is far more massive than any planet. So we can calculate the orbit of each planet as if it was only affected by the Sun. In principle, when we calculate the Earth's orbit, we should consider the gravitational effect of Mars and Venus and all the other planets. When we calculate Jupiter's orbit, we should consider the gravitational effect of Mars and Saturn and all the other planets. In practice, the force between any two planets is tiny compared to the force between the Sun and any planet. (Try it! Use the gravity law, and any listing the mass and distance of Solar System objects, and calculate the relative force in particular cases.)

Gravity is easy to understand when one object is by far the most massive. Then the massive object dictates the motions of all other objects. But what about the situation in which the objects in space have similar masses? Examples range from a small star cluster to an entire galaxy. No single star dominates the gravity of the system, so the gravity force between every pair of stars must be calculated. A very large number of calculations are required to model the system.

We can demonstrate the complexity of the gravity of many bodies by working out the number of gravity calculations required to estimate the gravity of a system of stars. We will use a progression from two to six stars. (The gravity of a single, isolated star can be calculated, but it is not very interesting!) We need to calculate the force between every pair of stars. Of course, there is no need to calculate the gravity force of a star on itself. Also, we can notice that the F_{13}, the gravity force of star 1 on star 3 is the same as F_{31}, the gravity force of star 3 on star 1. (Remember that you pull on the Earth with the same force that the Earth pulls on you.) This is true for any pair of stars. So we only need to calculate half of all the possible pairings of force.

How does the number of calculated forces increase with the number of stars? In the case of two objects, there is only one force — given by Newton’s law of universal gravitation, with F_{12}= F_{21} = GM_{1}M_{2}/R_{12}^{2}, where M_{1} and M_{2} are the masses of stars 1 and 2 and R_{12} is the distance between them. With three stars, there are three forces: F_{12}, F_{13}, and F_{23}. For shorthand, we are using a notation in which the subscript joins the numbers of the two stars being considered. The number of forces increases from 6 to 10 to 15 as the number of stars increases from 4 to 5 to 6. The general form of this progression can be easily shown. If n is the number of stars in the system, the number of separate forces (every object acting on every other object) is n (n-1). But we must divide by two because the force between each pair of stars only needs to be calculated once. In other words, F_{14} = F_{41}, F_{35} = F_{53}, F_{24} = F_{42}, and so on. The result is:

Number of forces = ½ n (n-1)

We can see that this works if we plug in the number from 2 to 6. The number of forces is 1, 3, 6, 10, and 15. But six stars constitute a puny star cluster. How does the number of forces increase as n becomes very large? Multiplying out, the number of forces is (n^{2}/2 - n/2). If n becomes very large, then n^{2} >> n and we can neglect the second term. For large numbers of stars, we find that:

Number of forces ∝ n^{2}

Solving the gravity of many bodies is a very difficult computational problem. The number of calculations increases with the square of the number of stars. Calculating the gravity of 50 stars is 25 times harder than calculating the gravity of 10 stars. Calculating the gravity of 1000 stars is 10,000 times harder than calculating the gravity of 10 stars. Can you imagine the computation involved in modeling the gravity of a galaxy with many millions of stars? It takes many hours on a powerful supercomputer to do the calculations. The good news is that computer power has been increasing exponentially for several decades. Doing a simulation of a large galaxy or a substantial chunk of the universe was impossible in the 1970s. It became challenging in the 1980s, and now it id doable. In fact, supercomputers are not required; many researchers use desktop computers with mutiple, fast processors.

Here is how the astronomers create computer models of stellar systems. Stars are given initial positions in three dimensions — not in real space but in the "computational" space of a computer. The external gravity on each star is calculated from the sum of the force exerted by all the other stars. This force changes each star’s motion and its position. With the position of each star adjusted, a new set of forces is calculated. The result is once again a change in the position and motion of each star. And this process is repeated over and over. Each set of calculations occurs at a particular time interval after the previous set of calculations. In this way, the motions of the stars can be predicted over a period of time.

Astronomers who do this kind of work are experts at computer programming. They use all kinds of computational tricks and shortcuts to make the calculations more efficient. For example, since gravity is an inverse square law, each star is more affected by its neighbors than by distant stars. So the accuracy of the force calculation can be lower for pairs of stars that are widely separated. Also the force does not need to be calculated as often when a particular star is moving slowly. This cleverness saves a lot of computing power. Instead of the computing requirement going up in proportion to the square of the number of stars, it only goes up in direct proportion to the number of stars.

Making a computer model of even a modest-sized galaxy requires the gravity of several million stars to be calculated at many time intervals. The fantastic increase in speed and power of modern computers has opened up the subject of computational astronomy. It has become a third way to understand the universe, in combination with observations and theory. Even a modest workstation can perform many millions of calculations per second. Our ability to simulate complex astronomical objects "in a computer" has given us a whole new way of looking at the universe.