### Another Piece of Pi

July 28, 2010 Last week we celebrated "Pi Approximation Day," July 22, or 22/7 when written in a day/month format. This fraction is a close approximation to the value of pi, a fact discovered by Archimedes. Archimedes estimated the value of pi using polygons inscribed in, and circumscribed around, a circle. It's a simple matter to get the perimeters of the polygons and ratio them to the radius of the circle to get π ≈ P/(2R), where P is the perimeter and R is the radius of the circle. As shown in the figure, it's possible to find the length of one side of any circumscribed polygon by using the tangent function. Archimedes didn't have trig tables, or a calculator with trig functions, so his analysis was limited to particular triangles, but the idea is the same. Archimedes obtained his estimate of 22/7 for pi using a circumscribed 96-sided polygon. This is the value of pi I learned in elementary school, and it's great for homework problems at that age level, when only integer arithmetic is known. Ptolomey decided to best Archimedes with a 360-sided polygon, from which he obtained 3,141666..., a value that's correct to three decimal places.*Circumscribed polygon*

Computer techniques have now allowed a calculation of pi to 2,699,999,990,000 decimal digits[1]. Our present estimate of the diameter of the universe is 93 billion light-years (8.8 x 10

^{26}meters), so we only need twenty-seven digits of pi to calculate the circumference of the universe to better than a meter, and thirty-eight digits to get a value of the circumference closer than the size of an atom. In a previous article (Buffon's Needle, July 19, 2010), I showed a physical method, devised by Georges-Louis Leclerc, Comte de Buffon, for obtaining a value of pi by dropping needles on floor boards and counting the fraction of needles that crossed the cracks between boards. Today, I'll present a different method to estimate pi that depends also on randomness. I was reminded of this method while reading an article[2] by David Patterson, a well known computer scientist, in this month's IEEE Spectrum. Patterson was addressing the question of how useful multi-core processors really are, and he gave some examples of problems that can be solved by parallel programming methods, including estimation of pi

"You could, for instance, determine the value of pi. Just compute what happens when you throw darts at a square board. If the darts hit random points on the square, what fraction of them fall within the largest circle you can draw on the board? Calculate that number for enough darts and you'll know the area of the circle. Dividing by the radius squared then gives you a value for pi."I remember this same simulation involving the casting of millet seed onto a circle inscribed in a square. This was possibly in deference to Zeno, who had a thing with millet seeds, but the idea is the same (see figure).

*Casting millet seed*

This is a Monte Carlo method[3], and it's quite easy to program. You can review my C code, here. As you remember, our Buffon's needle calculation made us 95% confident that the value of pi lay between 3.126605 and 3.156433. The millet seeds do a little better. For the same number of trials (10,000), and the same number of actions (100,000), we calculate a mean value of 3.141548 with a standard deviation 0f 0.005213. This means that we're 95% confident that the value of pi lies between 3.131122 and 3.151974, which is somewhat better.

*Histogram of pi estimates using the Monte Carlo method*

### References:

- Digits of pi on Wikipedia.
- David Patterson, "The Trouble With Multicore," IEEE Spectrum (July, 2010)
- For the history of the computational Monte Carlo method, see my previous article, Nicholas Metropolis, June 11, 2010.

*Permanent Link to this article*

RSS Feed

### Google Search

Latest Books by Dev Gualtieri

Thanks to Cory Doctorow of BoingBoing for his favorable review of Secret Codes!

Other Books

- Paving Materials - July 13, 2020

- 400 Years of the Novum Organum - July 6, 2020

- Isotropy of the Universe - June 29, 2020

- Bruce Baker and Minspeak - June 22, 2020

- Bottle Flow - June 15, 2020

- The Fine Structure Constant - June 8, 2020

- A Special Triangle Pair - June 1, 2020

- Philip W. Anderson (1923-2020) - May 25, 2020

- Worker Ants of Science - May 18, 2020

- Strength of Materials - May 11, 2020

- Spread Spectrum Communications - May 4, 2020

- Neutron Dipole Moment - April 27, 2020

- Freeman Dyson (1923-2020) - April 20, 2020

- Archival Data Storage - April 13, 2020

- SETI - April 6, 2020

- Larry Tesler (1945-2020) - March 30, 2020

- Power from Raindrops - March 23, 2020

- A Voice from the Crypt - March 19, 2020

- Computer Hashing - March 9, 2020

- Carbon Capture - March 2, 2020

- Knots - February 24, 2020

- When in Rome... - February 17, 2020

- Frigid Legos® - February 10, 2020

- Natural Materials - February 3, 2020

- Martian Atmosphere - January 27, 2020

- Whiskey - January 20, 2020

- An Elastocaloric Calorimeter - January 13, 2020

- Elastocaloric Effect - January 6, 2020

### Deep Archive

Deep Archive 2006-2008

**Blog Article Directory on a Single Page**