Calculation of net gravitational force