The kinetic theory of gases was developed initially by James Clerk Maxwell and Ludwig Boltzmann. Maxwell's calculation (1859) of the distribution law of molecular velocities in thermal equilibrium can be considered as the starting point of statistical mechanics, the first time a macroscopic, thermodynamic concept such as temperature was quantitatively related to the microscopic dynamics. Boltzmann's later work really laid down the foundations for this discipline, with the first microscopic analysis of irreversibility and the approach to equilibrium (1872).
The applet on this page is intended to help visualize the approach to equilibrium and the related question of irreversibility for the simplest kind of not-quite-but-almost-ideal gas--a gas of "hard spheres." (For people with Macintosh computers, a Mac-native application is also available.)
To use the applet, enter a number in the text field, click "Set", then click "Run." The "molecules" are spheres of radius one pixel (the default value; you can change the radius to two pixels by clicking in the "Make particles bigger" box) and do not interact except when they come in contact; then they scatter elastically. The small box on the right shows the distribution of speeds as the collisions take place. The blue line is the theoretical result for an ideal gas in thermal equilibrium--a two dimensional Maxwell-Boltzmann distribution.
Left to itself, the simulation will run for a long time; you will probably want to click "Stop" at some point. After the animation stops, you can check the microscopic reversibility of this system by clicking on "Reverse." This flips around all the velocities of the particles and runs the system for a time equal to the time it had run previously. In principle, that should "undo" every collision and restore the initial distribution of positions and velocities. You can see how roundoff error prevents this from happening after a sufficiently large number of collisions per molecule have taken place.
You'll find that the reversibility depends on the number of collisions per particle. (Keep in mind that when the number of collisions equals the number of particles, each particle has collided twice, on average.) The very fast propagation of roundoff error with each collision (extreme sensitivity to initial conditions) is an indication of chaos in this system.
How fast the speed distribution approaches the steady state seems to depend also on the number of collisions per particle. Check out also how the the relative size of the fluctuations about the steady state distribution is greater for fewer particles.
If you're interested in quantitative estimates, you will find a lot more information on the physics of this system on this other page!
If you have a really fast computer, you may want to slow down the animation. You may also experience some trouble with the "Number of collisions" and "Time elapsed" fields getting overwritten and not being erased properly. Clicking on "Pause" should clean them up.
Later on in the future I would like to do another applet showing how two different gases of hard spheres attain thermal equilibrium through their mutual interaction.
The algorithm for the hard-sphere dynamics was taken from the book An Introduction to Computer Simulation Methods, by Harvey Gould and Jan Tobochnik (Addison-Wesley, 2nd edition, 1996). Follow that link for further online resources!
This is my second-ever Java applet. The first one was a demonstration of vector addition; you can find it here. If you are interested in the source code, e-mail me (Julio Gea-Banacloche, firstname.lastname@example.org). Warning: I'm a physicist, not a professional programmer, so you'll find that my programming style is anything but exemplary!
Comments and suggestions are also welcome!