#### Description

The Ehrenfest experiment models a simple diffusion process as a Markov chain. Suppose that we have two urn with a total of \(m\) balls. The state of the system at any time is the number of balls in urn 1, so that the state space is \(S = \{0, 1, \ldots, m\}\)

In the basic model, a ball is selected at random at each time (so that each ball is equally likely to be chosen), and then moved to the other urn. The transition matrix \(P\) is given by
\[ P(x, x - 1) = \frac{x}{m}, \; P(x, x + 1) = \frac{m - x}{m}; \quad x \in S \]
In the modified model, a ball is chosen at random and an urn is chosen at random. Then the chosen ball is put in the chosen urn. The transition matrix \(Q\) is given by
\[ Q(x, x - 1) = \frac{x}{2 \, m}, \; Q(x, x) = \frac{1}{2}, \; Q(x, x + 1) = \frac{m - x}{2 \, m}; \quad x \in S \]
The states are shown in the top graph, with the current state colored red. At time 0, the initial state can be chosen be clicking on the desired state. As the process runs, the chain moves from state to state. The time and the sate are recorded at each update in the record table. The proportion of time that the chain is in each state is shown visually in the graph box in red and displayed numerically in the distribution table. The limiting distribution is shown visually in the graph box in blue and displayed numerically in the distribution table

The number of balls \(m\) and the initial state \(x_0\) can be varied with the input controls; the model can be chosen from the drop-down box.