Estimate Pi with hot dogs | |
I came across an article on digg that discussed how Pi can be estimated by tossing hot dogs. To do so, measure the length of a hot dog and set down strips of tape so that the strips are parallel and the spacing between strips is equal to the length of a hot dog. Then, toss your hot dogs towards the strips of tape. Keep track of the number of hot dogs that landed on top of a piece of tape. Finally, take the total number of Oscar Meyers thrown, multiply that by two and divide by the number of hot dogs that were on top of a piece of tape. With enough tosses, the estimated value should converge to Pi. Being a bored geek and not one to waste good hot dogs, I decided to write a program to see if this really worked. So, i pulled out the physics book, found the formula for tracing an object's trajectory, and went to work. The applet isn't very interactive with the only options for interaction being the three buttons in the upper right hand corner of the applet. After a couple thousand throws, the estimated value for Pi gets pretty close to the actual value. The white line on the graph at the bottom shows the actual value of Pi, with the y-range of the graph being Pi - 0.2 to Pi + 0.2. The plots for multiple runs can be seen by clicking the Start new run box. It should be noted that the x-range never increases past 200,000 and that hot dogs turn green when they've landed on a line. There's nothing mystical about hot dogs as you could take any stick-like object and the experiment would work. The principle at work here is based on the solution to Buffon's Needle Problem which "asks to find the probability that a needle of length l will land on a line, given a floor with equally spaced parallel lines a distance d apart" (mathworld). The proof for the answer can be found at the aforementioned link. | |
|