Galton Board

A Galton board is a vertical board with N rows of pegs onto which a ball is dropped.   Each time a ball hits a peg, it has a probability p of bouncing to the left and a probability of  1-p of bouncing to the right.  The simulation's histogram shows the distribution of final x-coordinates as each ball leaves the board and is collected into bins.

 

The simulation gives rise to the binomial distribution if the probabilities of left and right bounces are equal. At first there does not seem to be any pattern but after many trials the familiar "bell curve" shape begins to emerge.

Exercises:

  1. When there are N pegs on the bottom row, the probability of the ball landing at the nth peg (where the 0th peg is located to the far left in the diagram and the Nth peg is at the far right) is given by the Binomial distribution:
    PN(n) = (N!/n!(N-n)!)pn (1-p)N-n.
    Run the simulation on "high speed" for a while to build the histogram and compare the fraction of balls that arrive at a given peg with the probability given by the Binomial distribution.

  2. If you have EJS installed (see the Credits below), add an additional custom method to display the results of the Binomial distribution on the histogram for comparison. Note that for large values of the factorial (greater than 10!), you should use the Stirling approximation (or some other way of handling the large values of factorials since 25! uses 26 digits: see Computer Science wiki):
    lnN! = NlnN - N + ln(2πN)1/2
    Compare the simulation to the Binomial distribution.

References

Wikipedia: http://en.wikipedia.org/wiki/Galton_board

Credits:

The Galton Board Model was created by Wolfgang Christian using the Easy Java Simulations (EJS) version 4.1 authoring and modeling tool. The exercises were written by Anne Cox.

 

You can examine and modify a compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select "Open Ejs Model" from the pop-up menu.  You must, of course, have EJS installed on your computer.  Information about Ejs is available at: <http://www.um.es/fem/Ejs/> and in the OSP comPADRE collection <http://www.compadre.org/OSP/>.