A simple particle system

For no obvious reason, I had a sudden need to write a particle system that simulates a Maxwell-Boltzmann gas, which forms the basis for the kinetic theory of gases. The trick is to implement momentum-conserving collisions as the particles bang into each other. When setting the initial conditions, the particles get uniformly random velocity vectors….