Home    News    Links    Tigers   

4-Body Simulation!


Download the Chain.jnlp here


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 four 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.

The 4-body animation stops after a maximum time which is set in the Max. Time field. 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:

Since the movie is in two dimensions, the masses, X, Y coordinates and velocities of the four bodies need to be specified. Again the mass range should not exceed about one million and no two positions should be almost identical. The input template is deceptively simple but gives rise to a remarkable outcome in which two identical final binaries are escaping fast after exchange of components.

This beautiful result is due to the inherent symmetry where the critical close encounter converts horizontal motion into vertical motion such that the final binaries are more energetic. Because of the symmetries, only two other final states are possible for negative total energy:
(i) two escaping binaries along the X-axis, and
(ii) one binary and two disrupted components escaping with opposite Y-velocity.

Placing the initial positive X-values at X = 5.0 instead results in an even more elaborate celestial dance. Other dramatic outcomes may be generated by varying one of the Y-velocities by a small amount.

Another fun movie is generated by placing the four bodies at rest or with small X-velocities on the X-axis, which leads to a series of collisions until escape takes place.

After these exercises it is instructive to return to the three-body movie and try something equivalent. Now take the third body with for example X = 3.0, Y = 0.0, VX = -0.865 and VY = 0.0. Further interesting sequences leading to escape may be obtained by varying VX.