What
is it?
|
This
project simulates a classic science-museum exhibit in which
balls are dropped through a triangular bed of nails. When
a ball hits a nail, it probabilistically shifts either to
the left or to the right. At the bottom of the nails, the
balls form a Gaussian distribution.
|
How
to Use It |
Click
the setup button to setup the triangular
array of nails. Click the go button to
start the balls dropping through the nails.
The
depth slider controls the depth of the
triangular array of nails.
There
is a "bar" at the bottom of the screen to stop the balls
from falling. Click the remove-bar button
to remove the bar. The balls will continue to fall,
"wrapping" back to the top of the screen and falling
through the array of nails again. Click add-bar
to re-insert the bar at the bottom of the screen.
|
 |
|
Things
to Notice |
When
a ball hits a nail, it has a 50% chance of shifting to the
left and a 50% chance of shifting to the right. So each ball
is doing a horizontal random walk (while falling downward).
The depth of the triangular array of nails sets the number
of steps in the random walk. The resulting Gaussian distribution
is typical of a random walk.
When
you remove the bar at the bottom of the screen (by clicking
the remove-bar button), the balls "wrap" and
fall through the nails again. So each point in the original
Gaussian distribution becomes a mini-Gaussian distribution.
The overall distribution is the sum of these mini-Gaussian
distributions.
|
Explorations |
Change
the fall program so that balls are biased to shift
to the left when they hit nails (perhaps going to the left 75%
of the time). What is the effect on the resulting distribution?
|
StarLogo
Features |
The
setup-triangle procedure uses a special type
of "turtle recursion." When a turtle runs the procedure, it
hatches two new turtles, each of which runs setup-triangle .
The original turtle then dies. The current depth of the recursion
is kept as a local state variable in the turtles.
The
new-ball procedure creates a new ball and places
it at the top of the screen. There is a button that runs the
new-ball procedure every 0.2 seconds. An alternate
approach: Place one turtle at the top of the screen and make
it continually hatch new turtles. (But you must
make sure that the "hatching" turtle doesn't fall like the
other turtles.)
|