This project simulates the path of a marble falling vertically through a triangular pattern of pegs. The probability that the marble will bounce to the left at each peg it hits in its path is 1/2. The probability the marble will bounce to the right is also 1/2. The marbles collect in bins at the bottom. The marbles will collect in the bins to approximate what is called the 'normal distribution'. (For columns where the red marbles stop increasing the height of the column check the list for the actual total.) Click on the Green Flag. Click om 'Show List' to see the numerical totals for each of the 10 bins Click on 'Track' to record the path of the marble. Click on 'Fast' to speed the marble through the nine pegs. The normal distribution tells us that the majority of marbles will collect near the center of the board. The reason for this is clear as it takes nine consecutive bounces to the right for the marble to drop into bin number 10. The script is set to repeat 100 random walks.
The Galton Board (quincunx) was invented by Sir Francis Galton (1822–1911) as a mechanical device to demonstrate the 'normal distribution' in statistics. "He had noticed that a normal curve is reproduced by lead shot falling vertically through a harrow of pins…" http://www.encyclopedia.com/topic/Sir_Francis_Galton.aspx The Galton Board is nothing more than a gravity-powered random walk on the integer number line where the walker, starting at zero, flips a coin to move one unit to the right if a head or one unit to the left if a tail. The probability of flipping a head is 1/2 and the probability of flipping a tail is also 1/2 In the Galton Board, the coin flipping is replaced with a marble striking a peg and then going left or right with equal probabilities. There is a neat programming shortcut used to determine the bin number (1 – 10) that each ball falls into at the ninth peg.One just has to count the total number of 'lefts' (or 'rights') at the end of the ninth bounce. The order of lefts or (rights) is not important. At the bottom of each numbered bin. Click on 'Show List' to view the totals for each bin. Bin Number 1 2 3 4 5 6 7 8 9 10 Random Walker Positions -9 -7 -5 -3 -1 +1 +3 +5 +7 +9 Theoretical Values for Each Bin (9 flips) Bin Number 1 2 3 4 5 6 7 8 9 10 1 9 36 84 126 126 84 36 9 1 One Run of the Script set to 512 Marbles Bin Number 1 2 3 4 5 6 7 8 9 10 0 4 34 97 127 129 73 35 9 4 Remember, for an odd number of flips, only odd positions (equal to or less than the number of flips) on the number line can end a walk. The relationship between the number of bins and the number of flips (or bounces) is Bins = flips + 1. This project complements my other Random Walk projects: The Huckster's Game https://scratch.mit.edu/projects/68836046/ Feynman’s Random Walk https://scratch.mit.edu/projects/11282377/ Random Walk with Barriers https://scratch.mit.edu/projects/11300964/ Jean Perrin's Random Walk Experiment https://scratch.mit.edu/projects/87807676/ Random Walk on the Integer Number Line Probabilities https://scratch.mit.edu/projects/86951083/