Imagine a box that is divided into two parts of equal volume. The left half initially contains a gas of N identical particles and the right half is empty. We then make a small hole in the partition between the two halves. What happens? We expect that after some time, the system reaches equilibrium, and the average number of particles in each half of the box is N/2.
The purpose of this simulation is to gain insight into the tendency of macroscopic systems to approach a well defined equilibrium macrostate and the importance of fluctuations in equilibrium.
See: [Introduction to STP] and [Approach to Equilibrium]
Instead of simulating this system by solving Newton's equations for each particle (as is done in the other two simulations), we consider here a simpler model. Assume that the particles do not interact with one another, so that the probability per unit time that a particle passes through the hole in the partition is the same for all particles regardless of the number of particles in either half. We also assume that the size of the hole is such that only one particle passes through it in one unit of time. Each particle has an equal chance of passing through the hole at each time step.
One way to implement this model is to choose a particle at random and move it to the other side. This way is cumbersome because our only interest is the number of particles on each side. That is, we need to know only n, the number of particles on the left side; the number on the right side is N - n. Because each particle has the same chance to go through the hole, the probability per unit time that a particle moves from left to right equals the number of particles on the left side divided by the total number of particles, that is, the probability of a move from left to right is n/N. The algorithm for simulating the evolution of the model can be summarized by the following steps:
Updated 20 March 2020.