Program 3: 2 Body Simulation based on Observations

Introduction and Purpose

The reason of this program is the following question: Define Laws ?

This program simulates how for example 2 planets behave, solely based on observations.

The display shows the position of two objects m0 and m1, in pairs, after equal intervals.

m0 starts from the right of the screen.
m1 starts from the left of the screen.

At the left side are shown:

At the right side are shown:


  1. Right arrow key To modify the position of m0 in the +x direction.
  2. Left arrow key To modify the position of m0 in the -x direction.
  3. Up and Down keys To modify the position of m0 in the +y and -y direction.
  4. Tab key To select position 1, 2 or 3 of m1
    The position selected will change in red
  5. Esc key To terminate the simulation
  6. G key To change the value of G
Simulation In order to do the simulation proceed as follow.
  1. Select the Right Arrow key a couple of times and observe how the two objects behave.
  2. Select the Left Arrow key the same number.
  3. Select the Up Arrow key a couple of times and observe how the two objects behave.
  4. Select the Down Arrow key the same number.
  5. Select the Tab key twice and repeat the first four steps.
  6. Select the G key modify G and observe how the positions of m0 and m1 are independent of G. The values for m0 and m1 change.

Program: TWO_BODY.BAS source

In order to retrieve the source select:TWO_BODY.BAS
To see the listing select:TWO_BODY.HTM
Execution file select: TWO_BODY.EXE and: brun45.exe

Program: Technical Data

The simulation or calculation goes as follows:
  1. The initial data are three positions of m0, the first position of m1 and length between the first and second position of m1. All the positions are in screen co-ordinates.
  2. Calculate the distance r between m0 and m1.
  3. Calculate the second and third position of m1. Those positions are an mirror image of the positions of m0.
  4. Calculate ax, ay and a of m0
  5. Calculate the mass of m1.
    The mass of m1 = (a of m0) * r * r / G
  6. Do the same for ax, ay and a of m1 and calculate the mass of m0.
  7. Calculate all the positions of m0 and m1 for vsteps * isteps number of steps.
    vsteps is the number of visible steps.
    isteps is the number of invisible steps. This defines the accuracy of the simulation.

Contents of This Document


The two body simulation raises 3 questions:
  1. The display shows the position of two objects m0 and m1, in pairs. Each pair represents the real position in space of m0 and m1at the same time. The next pair is a time dt later. The simulation does not show what an observer sees. If you want to show the sky or sphere that an observer sees, you have to define the position of the observer and to take the speed of light into account. This concept is explained in the program TRAIN.BAS. For example: you can make a m0 centered view or a m1 centered view.
  2. Starting point of the simulation is the position of m0 at three fixed moments. The time between those moments is the same. For the next simulation you can change the positions but not the moments. In general this is not correct; when you change the positions you should also have the capabilities to change the time.
    To add to this complexity is the fact that observations are for example m1 centered. That means you have to make certain modifications in time and position to find the real positions.
  3. The simulation is done based on Newton's Law. This model is too simple. Gravity propagation has to be taken into account. How is the underlying reason of the question: How does gravity propagate.

Created: 9 September 1997 Last modified: 4 December 2001

Back to my home page Contents of This Document