Calculating Pi using Buffon's Needle
Drop a needle onto a series of parallel lines. After the needle lands,
see if it is crossing over one of the lines. Drop another needle, and then
another. Count the number of crossings as you drop more needles.
Divide the number of needles dropped by the number of crossings, and
the result is a number that begins to approximate Pi as you drop more
needles.

Be warned: Pi has an infinite number of digits (3.1415...), and so, the
best we can ever do is approximate it. There aren't enough needles
in the universe to calculate the exact number!


Created by Jeffrey Ventrella - www.Ventrella.com
About this Animation
This Java applet was created to see if Buffon's Needle experiment could be
done using a 3D physically-based simulation. The needles are modeled with
spring physics. It includes gravity, and a collision surface. A simple projection
scheme is used to create perspective distortion of the geometry of the needles
and the parallel lines.

This simulation drops 10,000 needles in all. Being a stochastic method,
the results are not always the same, and the accuracy varies from one
experiment to the next. The number will vary throughout the simulation,
but it will generally end up in the vicinity of Pi when the simulation is
done (within a few digits of accuracy). Apparently you need a hell of
a lot of needles to get more than a few digits right :)


About the Math
n - length of each needle
w - width between each line
d - number of needles dropped
c - number of dropped needles that crossed a line

Each needle must be dropped so that both its position and its angle are
random. n can be any value less than or equal to w. For most experiments,
n = w, which results in the approximation of 2Pi. In this variation of the
experiment, n = w / 2, and so the approximation of Pi is simply d / c.

The web sites below provide a more thorough explanation of the math.

George Reese
Hurben
Needle in 3D
Charles Stanton
Shodor
Klain and Rota
Paul Kunkel
Kimon Spiliopoulos