|
If more than two bodies are involved, then every body attracts every other body according to the law of general gravitation. Applying the rule of superposition the resulting force on one of them can be obtained by adding the force experienced from each of the other bodies.
Instead of calculating the force, the acceleration can be obtained directly using another law that Newton discovered :
a = F/m = k * M / (r*r).
where M is the mass of the other body, r is the distance between the bodies and k is the gravitational constant.
If the vector from m to M is (x1,x2,x3) then the distance is :
r = sqrt(x1*x1+x2*x2+x3*x3)
and the acceleration in each of the three directions are :
a1 = k * M * x1 / (r*r*r) a2 = k * M * x2 / (r*r*r) a3 = k * M * x3 / (r*r*r)
This calculation is repeated for each pair of bodies. If the universe contains N bodies this means N*(N-1)/2 pairs.
|