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

Free Downloads:

STEM artwork

for your holiday gifts

Latest Books by Dev Gualtieri

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

Other Books

- High Energy Cosmic Rays - November 13, 2017

- Advanced Aluminum Alloys - November 6, 2017

- Joseph Polchinski - October 30, 2017

- Our Magnetic Universe - October 23, 2017

- Cavitation - October 16, 2017

- Pell Numbers - October 9, 2017

- Miniature Antennas - October 2, 2017

- Fizzy Graphene - September 25, 2017

- The First Angiosperm - September 18, 2017

- Noise Thermometry and the Boltzmann Constant - September 11, 2017

- Walking in the Rain - September 4, 2017

- Agitated Atoms - August 28, 2017

- Partial Solar Eclipse at New Jersey - August 24, 2017

- Magnetocapacitive Tunnel Junctions - August 21, 2017

- Tardigrades - August 14, 2017

- Roman Concrete - August 7, 2017

- Solar Spicules - July 31, 2017

- Schroeder Diffuser - July 24, 2017

- Rough Microparticles - July 17, 2017

- Robot Musicians - July 10, 2017

- Walter Noll (1925-2017) - July 6, 2017

- cosmogony - July 3, 2017

- Crystal Prototypes - June 29, 2017

- Voice Synthesis - June 26, 2017

- Refining Germanium - June 22, 2017

- Granular Capillarity - June 19, 2017

- Kirchhoff–Plateau Problem - June 15, 2017

- Self-Assembly - June 12, 2017

- Physics, Math, and Sociology - June 8, 2017

- Graphene from Ethylene - June 5, 2017

- Crystal Alignment Forces - June 1, 2017

- Martian Brickwork - May 29, 2017

- Carbon Nanotube Textile - May 25, 2017

- The Scent of Books - May 22, 2017

- Patterns from Randomness - May 18, 2017

- Terpene - May 15, 2017

- The Physics of Inequality - May 11, 2017

- Asteroid 2015 BZ509 - May 8, 2017

- Fuzzy Fibers - May 4, 2017

- The Sofa Problem - May 1, 2017

### Deep Archive

Deep Archive 2006-2008

**Blog Article Directory on a Single Page**