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.
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.
Subscribe to Posts [Atom]