Recent work (Jan 2026)
This year I teach Physics 1 for second graders in Norwegian high school. Right now we are studying thermodynamics and also concervation of momentum. What better learning tool than a simulator?!?
New features
- The first atom is colored green so it is easy to follow.
- The travel path of the first H-atom is possible to plot in the simulation window.
- The average speed of all H-atoms is calculated and displayed. This should stay around the thermal speed.
- Some bug fixes and correcting the calculations of the velocity vectors.
- TODO: A graph window showing a histogram of the speeds of all H-atoms. This should follow a Boltzmann distribution, but we have way fewer particles in the simulation than what is needed for good statistics. My hope is also that we will be able to see the most probable speed (max of the Bolzmann curve).
New results (Jan 2026)
Here is a screenshot of the travel path of the green H-atom:

Background
In February of 2021 I wanted to simulate two particles colliding using conservation of momentum. It had been many years since I had done such calculations, but I now wanted to revisit former knowledge. And also show it graphically.
As time went by during spring I got more and more ideas for the simulation and suddenly I could simulate a 2D-box with gas particles of different kinds of atoms. Neat!
Result


You can run the simulation here: https://mauroy.no/particles. Still a work in progress.
Future upgrades
- Implement collision detection using a quadtree. Now every particle checks every other particle, O(n2) scaling. Not good.
- 3D-version using three.js but my own physics engine, just in 3 dimensions.
Screenshot of my early drawings and calculations. It was obvious that I could not calculate if I had sort of two unkowns and only one equation! The trick is to take into account that the collision is elastic, then the energy is conserved!

The final calculation for the momentum for an arbitrary elastic collision between two particles.
