Introduction
The program KINMODEL.EXE simulates in 2 dimensions the kinetic behavior of a user-specified number of spherical atoms with user-specified masses, colliding as hard elastic disks at a user-specified center-to-center distance. The initial positions and speeds of the particles are randomly generated by the computer and the simulation develops from the corresonding initial state. Information related to particle speeds, x- and y- kinetic energies, and energy distributions is provided in the form of unlabelled graphs on the screen.
The program was first written in 1993 and has been valuable to the author in physics, precalculus and statistics classes over the intervening years. The color-coding of the particles within chosen speed ranges was inspired by a simulation in Van Heuvelen's excellent materials.
This program is written in DOS to avoid the serious sacrifices of speed inherent in a Windows environment (and also because I haven't learned to program in Windows; I'm not sure where cause and effect lie).
The simulation can be stopped once it is running by striking the 's' key.
The default settings
The default settings are chosen to provide 30 atoms, one colored red, one blue and the others green. All atoms except the blue have equal masses, the blue atom having 10 times the mass of a green or red atom. The red and blue atoms each leave a marked trail, and the relative speed of the red atom is indicated on the screen. The simulated speed is appropriate for viewing on a typical 133-mhz Pentium with such goals as
estimating the distribution of atomic speeds and mean free path
equipartition of energy and the tendency for an ordered system to move toward disorder
the improbability of 30 particles being segregated on one side of the viewing area (unlikelihood of an ordered configuration)
the probability that a particle's speed will occur in a given range
the connection between relative particle mass and average speed
the development of empirical frequency vs. speed and frequency vs. energy histograms (order and disorder, this time with statistical order emerging from the disordered system)
images of 2-dimensional collisions
appreciation of time scale of kinetic interactions in a gas at typical pressures and temperatures (at medium default speed the simulation represents many of the features of a thin slice approximately 10 nanometers on a side and, say, a nanometer thick, of a monatomic gas at room temperature and several atmospheres pressure, with 1 second of real-world time corresponding to a few thousand years of simulation time).
and others.
Suggested experiments and activities
When the speed of the simulation is moderate it is possible to watch a specific particle (the red particle or the blue particle in the default simulation) and obtain an intuitive feeling for the relative frequencies of various speeds. Most students quickly see that the very high and very low speeds occur relatively rarely.
This aspect of particle behavior is best observed intuitively before data is taken. Data can then be taken by using the Pause key to stop the simulation at random intervals (without looking) and keeping a tally of the speeds of the observed particle (the observed particle for default settings will be the red or the blue particle, whose speeds are shown onscreen). The results can be plotted as a histogram.
The small graph consisting of blue dots follows this histogram for the red particle, for increasingly large numbers of observations. The evolution of this histogram in time will be different for different randomizers, while always approaching the same distribution, and can be used to gain an intuitive/experimental feel for random statistical fluctuations.
The function which models the relative frequencies of observed-particle speeds is a probability distribution, suitable as an example in a statistics class. This function also provides an interesting example of a product of two functions, one of which is a power function and the other a composite of an exponential and a power function. This example might be useful in a precalculus or calculus class.
It is also possible to observe a chosen particle (the red or the blue particle in the default simulation) for its mean free path between collisions. This observation becomes more involving if, for example, the observer is 'rooting' for the red particle (in the default simulation) to collide with the blue particle. The tracks left by these particles also provide a record of the path between collisions.
Using a simple computerized timer it is also possible to observe the mean time between collisions and, depending on the level of the course and the goals of the instructor, to possibly correlate the mean time, the speed distribution and the mean free path of the particles.
Once again if intuitive/experiential estimates precede hard data and analysis, the mathematical details are better seen in relation to the 'reality' they are representing.
The simulation begins with all particles moving in or very near to the horizontal (x-) direction. This is always the case in this simulation and can't be changed. At default speeds this orderly situation deteriorates rapidly and all traces are lost within a few seconds, making it intuitively and quantitatively obvious why energy is equipartitioned in this 2-dimensional simulation, and making the argument easier for higher numbers of degrees of freedom. The total x- and y- kinetic energies are displayed at every iteration of the simulation, making quantitative observations (e.g., stopping the simulation with the pause key) possible.
One custom option is to allow the program to record total x and y kinetic energies at short time intervals. When this option is chosen the program will record 2000 pairs of x and y energies and place them in a text file with a name of the user's choosing (warning: don't use long file names or path names since the program is in DOS; limit is 8 characters for files or directories).
Any selected region of the screen can be selected for viewing by masking the rest of the screen. The viewer can estimate the probability of this region being vacated within an hour, within a day, within a year, ..., within the age of the universe. Results will differ with the size of the region, the number of particles and the speed of the simulation.
The default settings include a speed 'window' within which the color of any particle whose speed is between 8 and 10 on the relative speed scale is changed to yellow. By observing the red or the blue particle it is possible to estimate the approximate proportion of the time spent by that particle between the selected speeds. It is also possible to watch the entire collection of particles and estimate the proportional number of 'yellow' particles, with speeds between the selected values. The two proportions should ideally be the same if all particles have the same mass, which is nearly the case here (the blue particle is the only exception). The discovery of this expected equality should be a pleasant revelation to many students.
The settings may be customized to select any relative speed range.
By observing the blue and red particles under the default settings the student will gain an intuitive/experiential understanding of the effects of relative masses on average speeds. Without prior knowledge that the blue particle is much more massive than the others most students will easily and reliably draw this conclusion.
By collecting data, which might be obtained from either the given velocities or from 'snapshots' of the paths of the red and blue particles in the default setting (ALT-PrntScreen should capture the image), the average relative velocities of the two particles may be determined within a certain tolerance.
The frequency vs. speed, frequency vs. squart root of energy, and frequency vs. energy histograms (it is left up to the student to determine which is which) are normalized to have a consistent total area. These distributions develop over time, eventually reaching a smooth distribution analogous to the Maxwell-Boltzmann distribution. This development occurs much more quickly if the settings are customized to encourage a maximal number of collisions.
It is easy to customize the settings to obtain two large relatively slow particles. Any student who has watched air hockey pucks or billiard balls colliding will recognize the validity of the simulation.
If the particles leave 'tracks' then a 'snapshot' in which a single collision between the particles occurs will provide data sufficient to validate conservation of momentum.
Customized settings
The following parameters can be controlled by electing to customize settings:
The number of particles (default setting is 30, maximum is 1000, which shouldn't be much of a restriction in the near future of PC's).
The number of different particle types (more than 9 different particle types is not recommended because of restricted number of colors).
The speed factor that determines how fast the particles move across the screen. If the speed factor is too great, particles may occasionally (or frequently, depending on how great) miss collisions. This is not a big problem unless data is being taken that assumes no 'misses'.
The radius of a particle (default radius is 1% the width of the square viewing area).
The proximity of the centers of the particles within which collision will occur (default is 5 particle radii). A greater value here will result in more collisions, other parameters being equal.
The minimum and maximum speeds defining a speed 'window'. Any particle whose speed is in this 'window' will be colored bright yellow. This range of speeds will be indicated by a yellow rectangle on one of the graphs.
Whether all the particles leave 'tracks' or not. The last two particles usually leave 'tracks'.
The number of iterations before the screen is cleared and the various graphs are updated. An iteration consists of the calculation and display of the position of every particle. A fairly small number allows the viewer to observe the evolution of the graphs, while a somewhat greater number permits observation of a significant number and variety of particle 'tracks'. If the number is too great the particle 'tracks' will be obscured.
The last two particles specified will have velocities indicated onscreen; the last of these particles will be sampled to obtain the velocity distribution shown at the right of the screen.
Potentially interesting 'research' questions
For which particle speeds is the time between collisions likely to be greatest, and for which will it be least?
Initial particle speeds are uniformly distributed. After a short time a specific nonuniform distribution of speeds takes over. How long does it take before the contribution of the initial uniform distribution to the graphs and histograms displayed on the screen become indistinguishable? How will the shape of the graph differ from the ideal distribution during the transition?
For the default settings, what is the 'peak' particle energy? What is the 'peak' velocity of the sampled particle?
A narrower speed range near the peak of the speed distribution can result in more instances of 'yellow' particles than a wider speed range away from the peak. At each possible integer speed v, it is possible to define a speed range (v0, vf) with v at the midpoint of that range, such that the average number of 'yellow' particles will be the same as for the 'unit' range around the peak of the distribution. The 'unit' range is a velocity range of width 1 unit centered at the 'peak' velocity.
What does it take to get a massive molecule surrounded by low-mass particles moving fast?
Does the presence of an even more massive particle give a medium-mass particle, surrounded by a greater number of low-mass particles, an advantage in achieving greater speeds? Does the presence of a more massive particle affect the energy distribution of the medium-mass particle?
At an advanced level: Derive Maxwell-Boltzmann distribution in 2 dimensions and compare the the empirical distribution.
Strange Behaviors
Sometimes the particles don't collide right, but sort of 'dance' with one another, sometimes for extended periods of time. The author is clueless as to the origin of this behavior. Of course, anything is possible so must be allowed, and who knows what might happen to the operators governing the workings of the computer under various group-theoretical symmetries?
Possible Extensions
This model is really pretty easy to program (by far the hardest part is working out the elastic collisions, and that's an exercise for an introductory-level College or University Physics student). The following modifications would be very easy, though in some cases the speed of the simulation would suffer. What's worth doing?
Thermal behavior vs. drift: For an electrical current in a conductor, carried by thermally excited electrons (using a non-quantum model), or for a wind blowing thermally excited air molecules around, the simulation could be modified to depict the relevant behavior of the particles.
Would a 3-dimensional extension be worthwhile? It would be much slower, but PC's are getting fast enough to handle it.
Giving the particles charges and various areas of the screen electric and/or magnetic fields would result in interesting effects.
Somewhat more difficult but still manageable modifications might include:
Thermal energy exchange with the walls of a container, showing the vibrations of fixed particles in the walls as well as the particles of the gas.
Diatomic (or even polyatomic) molecules in two (or 3) dimensions.
A cycle of a heat engine, showing increased or decreased energies on collision with container walls and advancing/receding piston.