David Hussein Brunton
Friday, August 8, 2008
  Buffon's Needle, With Processing 0135
Buffon's Needle is a fun little experiment that relates to physics, math, statistics, and the Monte Carlo method. Basically, you draw lines on the floor, spaced an equal distance apart, and you throw needles (of the same length as the distance between the lines) on the lines. The ratio of needles on a line to needles off of a line allegedly converges on twice-Pi.

I didn't have the patience to do this with actual needles, but I did make a little Processing Applet that simulates the experiment with reasonable success. There was some math involved in the writing of the applet, which (in my case) leaves a lot of room for errors. But the calculation does seem to head toward Pi most the time (in the display, I divide the ratio by two for visual effect).

Plus it's kind of pretty.

Buffon's Needle, in Processing.
 


Links to this post:

Create a Link



<< Home
Change.

Name: David Brunton
Location: Washington, DC, United States
Archives
January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / July 2007 / August 2007 / September 2007 / December 2007 / January 2008 / February 2008 / March 2008 / April 2008 / June 2008 / July 2008 / August 2008 /


Powered by Blogger

Subscribe to
Posts [Atom]