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:
- The mass the of m1
- The value for G
At the right side are shown:
- The mass the of m0
- The first three positions of m0 in screen co-ordinates.
The screen co-ordinates of the top right corner are: (640,480)
Operation
- Right arrow key To modify the position of m0 in the +x direction.
- Left arrow key To modify the position of m0 in the -x direction.
- Up and Down keys To modify the position of m0 in the +y and -y direction.
- Tab key To select position 1, 2 or 3 of m1
The position selected will change in red
- Esc key To terminate the simulation
- G key To change the value of G
Simulation In order to do the simulation proceed as follow.
- Select the Right Arrow key a couple of times and observe how the two objects behave.
- Select the Left Arrow key the same number.
- Select the Up Arrow key a couple of times and observe how the two objects behave.
- Select the Down Arrow key the same number.
- Select the Tab key twice and repeat the first four steps.
- 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:
- 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.
- Calculate the distance r between m0 and m1.
- Calculate the second and third position of m1. Those positions are an mirror image of the positions of m0.
- Calculate ax, ay and a of m0
- Calculate the mass of m1.
The mass of m1 = (a of m0) * r * r / G
- Do the same for ax, ay and a of m1 and calculate the mass of m0.
- 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
Reflection
The two body simulation raises 3 questions:
- 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.
- 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.
- 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