Sunday, March 14, 2010
Little Oscar and I celebrate Pi Day in style with our annual ceremonial calculation of π
Little Oscar really loves pi, maybe because he's so fond of running around in circles -- in any event he's a big fan of Pi Day, the 14th day of March, the third month. But he's also absent-minded. He and I might both have missed it if T had not reminded us. We figured we might as well celebrate in the middle of the night. Since we're already losing sleep by setting our clocks ahead, what difference does a little more make? We'll feel the same tomorrow.
What better way to celebrate than with a ritual reenactment of a famous statistical method for deriving the value of pi? Buffon's Needle is a simple method of calculating pi to as many places as you want simply by throwing needles at two parallel lines and keeping track of how many fall between the lines and how many cross the lines. Of course, to get an accurate value, you have to throw a hell of a lot of needles.
We sped up the process by using a computer, with virtual lines and virtual needles -- which it could flip a lot faster than we could. Nobody ever said this was an efficient way to calculate pi. It took more than 14,000 tosses for the simulation to consistently lock in on three significant digits, and we weren't going to wait for the fourth. You can run the simulation yourself at this link. Your mileage may vary -- but in any case, it's fun to watch how quickly that red line, after some initial floundering, converges on a very rough approximation of pi.
The simulation also demonstrated that, in the real world, you would have to throw so many needles to derive a useful value of pi that you wouldn't actually be able to count the needles. (Long before we tossed 14,000, the lines were totally blacked out by piled-up needles.) But it's interesting nevertheless.
Buffon's Needle is a famous problem in the field of geometrical probability and was first stated in 1777 by Georges-Louis Leclerc, Comte de Buffon, a French naturalist, mathematician, cosmologist, and author. You can read more about it here, and also check out another simulation. And here's more commentary.
Whatever detailed knowledge of calculus and analytic geometry I ever had has long since abandoned me, so I have to take the demonstrations of how these random needle tosses are related to π on faith. But the bottom line is that you can calculate pi from the needle drops by simply taking the number of needle drops, multiplying it by two and then dividing by the number of hits. That is, if D represents the number of needle drops and H represents the number of hits, then 2D/H = π (approximately).
As we noted, this is actually not very useful for finding pi in the real world. Is there anything Buffon's Needle is good for? Actually, there is. Flip that formula around, and it tells you the probability of getting hits. Turns out that your chances are better than six out of ten -- 2/π, or .6366. This is counter-intuitive, since most people at first glance think the needles are more likely to land in all that open space between lines. This can be usedto shift the odds in your favor in some cool parlor tricks or bar games. Here's a demonstration.
Happy 3.14159... Day!