## Welcome to Dijemeric Visualizations

Where photography and mathematics intersect with some photography, some math, some math of photography, and an occasional tutorial.

## Tuesday, March 13, 2012

### Some Random Thoughts for Pi Day

Some Random Thoughts for Pi Day

Everyone at one time learned that Pi is the ratio of the circumference of a circle to its diameter and the value is 3.14 and a lot more digits following.  Is there an end to the digits and is the sequence of digits random or is it determined by some as of yet unknown formula?  And can the digits in Pi be produced by a random number generator?

I'll leave the first two questions to others, but a simple Excel program to generate random numbers can be used to produce an estimate of Pi.  Consider a circle with a diameter of 2 feet.  The radius will then be 1 foot and the area Pi square feet.  If it is enclosed inside a square, the square will have sides of 2 feet with an area of 4 square feet.   The ratio of areas of circle to square will then be Pi/4.  Suppose you now throw darts at a dart board with a diameter of 2 feet enclosed in a square.  The ratio of hits inside the board divided by the number of tosses inside the square will be the same as the ratio of areas.

Write a program to generate two sets of random numbers bounded by zero and one (0,1).  These will be the coordinates for a point to be tested.  If the distance of the ordered pair to the center is less than one it is inside the circle.  If it exceeds one it is outside the circle.  Below is a screen shot from one run of the program.  The blue line is the running estimate of Pi for the specified number of dart tosses.  The purple line is the error calculated as the difference between the estimate and value of Pi to 2 digits (3.14)

If you'd like to try estimating Pi using the program, you can at Estimating Pi Spreadsheet