Thomas A. Moore -- September 2007
This program demonstrates how purely random exchanges of energy between the "atoms" of two systems leads to the two systems coming into thermal equilibrium as well as the fluctuations that occur once the system has reached equilibrium.
Each of the two systems in this case is a 2D array of simple quantum harmonic oscillators. In the default case, each system consists of 400 oscillators arranged in a 20 x 20 array. On the screen, each system is represented as a rectangular area divided into smaller square cells, each cell representing one of the oscillators. The quantum oscillators can each hold an integer number of units of energy. The color of each cell in the display represents the energy held by the corresponding oscillator: the cell is black if the corresponding oscillator contains no energy, and becomes a brighter and brighter red (eventually yellow) as its energy increases. The cell is white if the oscillator contains 20 units or more of energy. In the default case, system A has zero units of energy (all the cells are black), and each oscillator in system B has 5 units of energy (and so is a reasonably bright red).
Pressing the Do A Step button causes the program to scan through every oscillator in the two systems. If a given oscillator has any energy, the program randomly chooses between the following 9 possibilities: giving one unit of energy to any one of the oscillator's 8 surrounding neighbors or keeping the energy unit (i.e. doing nothing). The choice is purely random, and each of the 9 possible actions is equally probable (though if the oscillator is on an edge and has no neighbors on a certain side, it is proportionally more likely to keep its energy). If the oscillator is on the boundary between the two systems, then its energy might go across the boundary to the neighboring oscillators in the other system, just as if they were ordinary neighbors. The computer program knows nothing about entropy, equilibrium, or temperature: it simply repetitively executes this process of random energy redistribution, and so provides a simple model of microscopic random energy exchanges.
Pressing the Evolve button is equivalent to pressing Do A Step continually. The graph at the bottom of the window displays the total energy in system A as the random energy exchange progresses. You can select how often the graph is updated using the pop-up menu above the Do A Step button (choosing longer periods between updates will help the program run faster).
You should see that as time passes, there is indeed a net flow of energy from the "hotter" system (the one which initially had more energy per oscillator) to the "colder" system. Eventually (after roughly 30,000 steps for the default setup), the systems will come into a fluctuating equilibrium with each system having roughly the same amount of energy per oscillator. Once you have pressed the Evolve button, it is relabeled Stop, and pressing this button at any time will stop the calculation. Pressing the Reset button restores the systems to their initial state.
You can vary the initial state of the system by using the pop-up menus above each system to change the number of oscillators in each system and/or the initial total energy of that system. The energy is always initially spread out evenly among the oscillators, but you should note that in equilibrium, the energy is not evenly distributed (in fact, if you check at any instant once equilibrium is established, you should find that the probability of a given oscillator having a given amount of energy decreases exponentially with energy, as predicted by the Boltzmann distribution).
Here are some things you can investigate and think about. Does the above parenthetical statement hold before equilibrium is established? How do you decide "when equilibrium is established?" How does changing the relative size of the systems or their initial energies effect the time required to go to equilibrium and the size of fluctuations once equilibrium is established? For a given set of initial conditions, does the system always reach equilibrium in roughly the same number of steps? If so, how rough is "roughly?"
I have tried to make this program as transparent and as easy-to-use as possible. Please send any bug reports or feature requests to me at email@example.com. This program was written using REALBasic, a superb development environment for Macintosh, Windows, and Linux platforms. For more information, visit www.realbasic.com. This program is freeware, and may be freely distributed, used, and/or modified, subject to the terms of the GNU General Public License, version 2 or higher (http://www.opensource.org/licenses/gpl-license.php).