But the above simulation did not really calculate the collision effect. It only use theoretical result to show expected result. I will try to create one which mass are not the same.
It is done. The following is the real simulation.
It is not quite the same as the above one, when all the mass are the same. (It is due to numerical error, but it is close to the real device).
When the simulation is paused: you can use slider to change the id (from 0-4) , then change the mass for the selected particle.
Press initialize to freeze all the particle, and move the first one with a small angle.