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.

Comments (2)
  1. Another awesome program from Zock!

  2. anonymouscommenter says:

    Hello Zock

    excellent program! I'm going to the kept!

    However, we know that the orbits of the planets are dictated by the law of Kepler. which specifies the 3 following facts:

    1. planetary orbit is not a circle but an ellipse.

    2. the Sun is not at the center aim at a focal point of the elliptical orbit.

    3.neither the linear speed nor the angular speed of the planet in the orbit is constant, but the area speed constant is

    Is that you have taken into account in your program?…/Kepler%27s_laws_of_planetary_motion

Comments are closed.

Skip to main content