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:

- Generate a random number r from a uniformly distributed set of random numbers in the interval 0 ≤ r < 1.
- Compare r to the current value of the fraction of particles n/N on the left side of the box.
- If r < n/N, move a particle from left to right, that is, let n → n - 1; otherwise, move a particle from right to left.
- Increase the time by 1.

- Describe the behavior of n(t) for various values of N. What is the minimum value of N for which you can say that the system approaches equilibrium? How would you characterize equilibrium? In what sense is equilibrium better defined as N becomes larger? Does your definition of equilibrium depend on how the particles were initially distributed between the two halves of the box?
- When the system is in equilibrium, does the number of particles on the left-hand side remain a constant? If not, how would you describe the nature of equilibrium?
- If N ≥ 32, does the system ever return to its initial state with all particles on the left-hand side of the box?
- What is the qualitative time-dependence of n(t) as the system approaches equilibrium for large N?
- How does <n>, the mean number of particles on the
left-hand side, depend on N after the system has reached
equilibrium? For simplicity, the program computes various averages
from time t = 0. Why would such a calculation not yield the
correct equilibrium values? Use the
`Zero averages`button to compute the averages after equilibrium has been established. - The quantity σ is defined by the
relation, σ
^{2}= <(n - <n>)^{2}>. What does σ measure? What would be its value if n were constant? How does σ depend on N? How does the ratio σ/<n> depend on N? In what sense is equilibrium better defined as N increases?

Updated 20 March 2020.