I was hoping to start this post with a good cooking/science pun but I feel like all the good ones argon. So let’s not waste our thyme with yolks and cut to the chase. As our clumsy Gregorian calendar jumps us discretely from just-less-than Pi Day to tomorrow, it would be irrational not to honor the occasion with my favorite Pi recipe. I can’t take credit for the original recipe, but everyone’s implementation is different! So without further ado…
Adam’s Monte Carlo Pi Recipe
- Begin with one unit square. Divide into one perfect circle of radius 0.5
- Obtain an infinite number (if you don’t have literally forever, thousands will do) of your favorite Pi topping – personally prefer smaller perfect circles to give it a flaky, fractal crust, but anything small and discrete will do
- Begin placing your topping all over your square indiscriminately. Really, go nuts! Don’t worry about missing the circle – in fact, it’s important that you do miss the circle at times for the recipe to really work. This step is really fun if you have kids!
- Continue distributing your topping across the unit square… keep going… no, that’s not enough yet. Seriously, keep going. I mean, sure, you could stop, but do you want a Pi or just ≈Pi?
- Have you used all of your infinite topping yet?
- Ok! So the unit square is completely covered in delicious smaller-circles or points or whatever! Write down the number of circles you placed on the unit square… you were keeping track right?
- Count the number of points that fell within the circle you drew
- Finally, divide (# of points inside circle)/(# total points), then multiply by 4. It should look something like this:
- Guess what? You’re done! That’s the Pi! Enjoy!
But wait, how is this a Pi?
Well, a unit square has an area of 1. A circle with radius r = 0.5 has an area of . Take the ratio of the area of the circle and the area of the square,
And by counting the number of points in both the square (total number of points) and the circle, you obtained a good measure of the area of the circle and the square! That means,
(That’s right, no = for you… I know you cheated – I know you didn’t use an infinite number of points. It’s ok though, I’m sure it will still turn out fine.)
For an interactive demo of this technique, check out this link!
Happy Pi Day!