Sunday, May 18, 2014

Parallel Mouse

   In an earlier post (see Angle Mouse and Other Scratch Geometry Projects (April 15, 2014)
I suggested that coding a geometry concept in Scratch is a higher-level cognitive task than just memorizing a geometric definition.
   To illustrate this belief, I shared with readers two Scratch projects, Angle Mouse
and, Perpendicular Mouse 
   Here is a third example called Parallel Mouse. As the screenshot shows, a mouse (seen in top down view) constructs three pairs of parallel lines. The code that directs the mouse to do this is simple and is a good example of sequencing as a programming skill.
   The project itself can be viewed and downloaded by clicking on this link.
   If you view the project in action, the mouse will report that as it draws a line and then goes to a random point on that line, it turns left 90º, lifts the pen, moves forward a given distance, turns right 90º, and then draws the line parallel to the first line.
   Asking young students to code parallel lines is a good programming exercise but my project can be taken a step further. It can be generalized in the sense that the mouse can turn through any angle, say angle x.
   In figure (a), the mouse has drawn the first line and moved to a random point on the line. In (b), the mouse has turned left through an angle, xº.
   In (c), the mouse moves forward a given distance to another point.
   Finally, in (d), the mouse turns right xº and is in position to move back and forward to draw the line parallel to the first line.
   If the diagram (d) is looked at as parallel lines cut by a transversal, then it can be seen that the corresponding angles are equal! Math texts simply state that fact about corresponding angles whereas the young Scratch programmer, if asked to code a program that constructs parallel lines, can discover that fact for themselves.

Friday, May 9, 2014

Count Buffon's Needle Problem

  The foundation of probability theory was established in 1654 through a series of letters between Blaise Pascal and Pierre de Fermat. These letters traded solutions to a gambling problem raised by the Chevalier de Méré.
   Probability theory grew slowly over time. Approximately one hundred years after Pascal and Fermat solved a gambling problem, Count Buffon analyzed another gambling problem. Surprisingly, his analysis revealed  a close connection between a game involving dropping a needle onto a grid of regularly spaced lines and the number Pi (π).
   Gamblers at that time were beginning to realize that understanding the theory underlying any game would allow them to maximize winnings and minimize losses.  
   Count Buffon was born into a wealthy French family and spent his life pursuing his interests in mathematics, physics, and natural history. His love of nature led him to become curator of French Royal Gardens and Museum.
   The simplest case of Buffon’s needle problem is when the separation of the lines, L, equals the length of the needle. The question then becomes what is the probability that a needle dropped on a grid of these equally spaced lines intersects one of the lines?
   The needle problem is an early example of what we now call geometrical probability because its solution involves the ratio of two known areas.

   The project can be viewed and downloaded by clicking on the following link.
   View this short video to observe a 1000-needle run of the Buffon Needle simulation. The simulation starts by dropping a single needle three times to show you how it works and then the slider is set to 1000 needles. Check the Approximation to π window in the lower left corner when the simulation ends.

   As usual, a free PDF document describing the mathematics and Scratch programming techniques is available on request by sending an email to