In last week’s article “How I almost got punched in the face at work” I said that I calculated pi 3.14… by setting up a plate, a napkin, and standing up four menus on a table and throwing bread crumbs on it. I received many messages over the past week to share this amazing demonstration of high quality science. I was a little drunk in the story when I did it but it also works sober. So I will leave out the test preparation steps. I have actually found that it is better when you don’t do the prep steps because you don’t forget the breadcrumb count as often.

The method that makes this possible is the Monte Carlo simulation method. I can describe how it works in three sentences.

If you have an equation that relates variables, you can use Monte Carlo to estimate the variable values. The method consists of using a random number generator for the variables and calculating the remaining variables. Multiple runs averaged will converge on the true values.

So how did I calculate pi “3.14159265359…” with a plate, a napkin, four menus, and what felt like a kaziliion bread crumbs.

First we create an equation that has the variables we want to relate. In this case it was a square and a circle. The square has sides that are equal to 2X the circle radius. Place the circle inside the square and then randomly drop points in the the square. Count the ratio of point lands in the circle vs total points thrown. This ratio put to the ratio of the circle and squar areas equations will estimate pi. (See illustration)

It’s crazy simple and if you want to play with it you can find many calculators and code to execute it online. The part that always amazes me is how fast it convereges. After 30 throws I had already estimated pi as 3.46, by 120 throws it was estimated to 3.13. A random number generator can drop 10,000 points in a fraction of a second and get you pi out to 5 decimals.

-Adam