Homework 9

Purpose: Threading experiments
Two spheres of radius R=1 and mass M=1 are located at the coordinates (100, 100) and (100, -100) on a plane. They start moving at the same time.
There are two forces involved: a stationary attraction potential centered in (0, 0) having the value -2/(r+1), and a rejection potential between the spheres of value 1/(r+1).

1. Implement a threaded program that simulates the trajectory of the two spheres and finds the position where the two spheres collide (the distance between centers is smaller than 2*R).

2. Observe numerical stability of the algorithm if the initial position of the spheres is (100/sqrt(2), 100/sqrt(2)) and (-101/sqrt(2), -101/sqrt(2)).
Compare to the case when the initial position of the spheres is (100, 0) and (-101, 0).
Both of these cases should have 1D geometry, is this preserved during the simulation?

3. Experiment with more spheres and various initial positions.

4. Implement a rigid elastic collision model and look for the first 100 collisions in a simulation with 4 spheres.
Study the evolution of the energy distribution.