- This program simulates the Ehrenfest model for gas diffusion by simulating the urn-ball experiment described in the book. You input the number of balls and the number of time units. The program displays a plot of the experiment, with the x-axis showing time and the graph y = f(x) showing how many balls are in the first urn at each second x first for time in the natural order and then for time reversed. (Note: the program actually plots points only for integer values of x, since the distribution of f(x) is discrete; however, for the sake of aesthetics, the computer joins these points with lines.)


The source.