## 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. ## 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! 