Saturday, January 25, 2014

The Monte Carlo Method Used to Approximate Pi

The Monte Carlo method is a mathematical technique used to approximate the solution to a problem for which no known method for obtaining an exact solution is known.
This project uses darts thrown at a circle inscribed in a square to illustrate the method. The ratio of the area of a circle inscribed in a square to the area of the square is π/4. If the ratio of the number of darts that land in the circle to the number of darts thrown (assuming all darts hit in the square) is multiplied by 4 then the result approximates the value of Pi. The more darts thrown, the closer the approximation.
Below is a screenshot of the project. The project makes use of the parametric form of the circle equation, random numbers, and the Pythagorean theorem. To view and download this project just click on this link.

To obtain a free pdf file that provides more detail about this Scratch project send an email to grandadscience@gmail.com.

Saturday, January 11, 2014

One Blind Mouse – An application of the Distance Formula

In the previous post (The Distance Formula in Scratch, January 2014) I presented a tutorial on programming the distance formula from analytic geometry in Scratch.
This Scratch project, One Blind Mouse, uses the distance formula to model how a blind mouse using its sense of smell can find a piece of cheese. The closer the mouse is to the cheeses, the stronger the smell and the farther away the mouse is from the cheese, the weaker the smell. Watch this very short video of the project.
In the project, the algorithm causes the blind mouse to move over the plane, turning towards the cheese so as to continually shorten the distance between it and the cheese. When the red tip of the mouse's cane touches the cheese, the mouse has found it. Note that the mouse always spirals into the cheese even though 'spiral' is not in the code!
You can view and download the project by clicking on this link.

Tuesday, January 7, 2014

The Distance Formula in Scratch

I've written a short tutorial (in pdf format) that takes you step by step through the process of coding, in Scratch, the distance formula from analytic geometry.
The tutorial follows the Algorithmic Thinking Model (see the December 2012 post, Algorithmic Thinking) that teaches that programming (or, to use the current term, coding) is a set of skills and not a single skill.
View this short video that shows one of the Scratch scripts discussed in the tutorial. In the video, an ant chases a mouse-pointer as the pointer is moved around the screen. The distance between the ant and the mouse-pointer is computed using the distance formula. The script stops if the distance between the ant and the mouse-pointer is less than one.

You can obtain a free copy of the Distance Formula Tutorial describing how to code the distance formula to create the script seen in the video by sending and email request to grandadscience@gmail.com.