Small Basic Featured Program - Gravity Simulator

This is a Gravity Simulation by Zock77, the import code is FHS907.

It includes self interaction between orbiting satellites - they attract each other.

The gravitational force attracting objects is given by Newton.  If the object masses are M and m and their separation is r, then the force of attraction is:

F = GMm/r2

G is the gravitational constant and r2 is r squared.

The force is on a line between the two objects and acts as an acceleration on both objects towards each other.  The acceleration of each object (A and a) is proportional to the force and inversely proportional to its mass, F = M.A and F=m.a.

The sun's mass is 50 times that of the satellites and is set to remain stationary, and it dominates the trajectories of the orbiting objects. 

A couple of suggestions to try playing with the code.

  • Get the sun to wobble with the orbiting objects.
  • Set the satellites to have a mass equal to the sun.

Nice program Zock.