The Probability Pipe Organ


Sorry—it appears your browser doesn't understand Java applets.

This page, which requires a Web browser that supports Java applets, demonstrates how experiments with random data converge toward the predictions of probability theory as more and more experiments are run.

The panel above initially shows the bell-curve normal distribution approximating the binomial distribution for an experiment consisting of 32 coin flips. To see the the bell curve for experiments with different numbers of flips, enter a value between 4 and 1024 in the “Flips/run” box and press Enter. For large numbers of flips, the bell curve will be very narrow, since the probability of a large excess of heads or tails is very low. In every case, the peak of the bell curve, the most probable result, represents an equal numbers of heads and tails.

Pressing the “Start” button begins a series of simulated experiments, each consisting of the number of flips specified by “Flips/run”. The number of heads are tallied and displayed as a histogram superimposed on the normal curve. As more and more experiments are run, the scale of the histogram bars is adjusted so the tallest bar remains as high as the peak in the normal curve. Press “Pause” to suspend the running of experiments; press “Resume” to continue after a pause. “Stop” ends the sequence of experiments, with the final result plotted on the chart. If you like, you can enter a new value for “Flips/run” and press “Start” to conduct a new series of experiments.

Observe how at the outset, especially for experiments with relatively few flips, results may appear to depart substantially from the chance expectation, but as more and more experiments are run, the results converge ever more closely on the prediction from probability theory. The initial outlying results “scroll down” as more and more experiments produce the most probable outcomes.

The Press that Refreshes. Due to what I'll politely deem eccentricities in Java implementations on certain operating and window systems, an applet is not always notified when the window of the browser that's displaying it is exposed after having been obscured by another window, nor when the applet is scrolled back into view after having been partially or entirely off screen. Many applets work around this by always repainting the entire applet window for every update, but for an applet with a graphical display as large and complicated as this one, this results in jerky animation and distracting flashing on the screen. If you cover up the image and later expose it and it's not automatically repainted, just press the “Repaint” button to restore it. Perhaps an upcoming release of Java will render this button unnecessary.


by John Walker