How to Bake a Pi

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

  1. Begin with one unit square. Divide into one perfect circle of radius 0.5
  2. 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
  3. 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!
  4. 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?
  5. Have you used all of your infinite topping yet?
  6.  Keep
  7.  Going
  8.  Until
  9.  You
  10.  Run
  11. Out
  12. Of
  13. Topping….
  14. 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?
  15. Count the number of points that fell within the circle you drew
  16. Finally, divide (# of points inside circle)/(# total points), then multiply by 4. It should look something like this: CodeCogsEqn (1)
  17. 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 CodeCogsEqn (4).png. Take the ratio of the area of the circle and the area of the square,

CodeCogsEqn (5)

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,

CodeCogsEqn (6)

(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!

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s