3Body Simulation!
Download
Download the Triple.jnlp here
Instructions
Click here or on the image to the left to see a bigger and animated version of the triple graphical user interface.
At first, the initial conditions have to be specified. These are the masses of the bodies, their positions in X and Y coordinates ("X Posn" and "Y Posn") and their initial velocities in X and Y components ("X Vel" and "Y Vel"). This is done by filling the fields in the "Particle parameters" box.
Beware that the code will not work for a body of mass 0 or of negative mass.
If you give all three bodies the same initial velocity, i.e. the system is in translation, this will not appear and it will not affect the simulation. The only things that matter are the relative positions and velocities.
When the simulation is launched by clicking on the "PLAY" button, the code will calculate the relative positions and velocities, and the centre of mass. Note that the mathematical method employs the centre of mass to simplify the treatment. So the first step the code takes is to shift all bodies such that the centre of mass is at the center of the panel. Again, the relative positions and velocities you entered as inital conditions will not be altered by this.
Then, the animation starts. You can see the bodies swirl around each other and depending on which initial conditions you use, you might find a very exciting animation, or a very symmetrical one, etc. We recommend you watch the close encounters: Does each body encounter the other two in such a close encounter or is there one body that encounters the other two each at a time? Which body escapes in the animation? The heaviest, the lightest, the one with highest or smallest initial velocity? Are these things systematic? You can obtain a vast number of very different results from similar initial conditions, and have fun exploring them!
The 3body animation stops when one body escapes the system. Below are explanations as to what the other buttons do:
 Scale: This shows the animation in larger or smaller size, particularly interesting to look at close encounters for example.
 Smoothness: This parameters changes the smoothness with which the animation is generated. The higher the smootheness, the smoother the trajectories, but the longer the generation of the orbits.
 Show Orbits: Tick this box if you want to see the traces of the orbits of the three bodies like on the image here on the right.
 Pause: This pauses the animation. When the animation is paused, you can change the scale of the display panel. After Pause you cannot change initial conditions so either Play or Reset.
 Reset: This resets the bodies back to their initial positions.
Example initial conditions:
The initial conditions for an idealized triple system of Earth, Jupiter and the Sun are as follows.
Masses: 0.000003, 0.001, 1.0
coordinates: X = 1.02, 5.46, 0.0 and Y = 0, 0, 0
velocities: VX = 0, 0, 0 and VY = 0.98, 0.417, 0.
Note that the Sun should be the third body here. It does move by a small amount to compensate for the two planets.
Amother interesting example in two dimensions: Place the first body at Y = 0 and positive X, with negative Yvelocity. Take two other bodies of the same mass at X = 0 with positive and negative Y, starting from rest. Varying the magnitude of the incoming velocity will generate a family of interesting symmetrical orbits with the binary oscillating in the Ydirection. The symmetry can be broken by including a
small Yvelocity for the first body. In practice it is advantageous to choose the third (reference) body as the most important.
