The Buffon Needle Problem and a Computer Simulation
One can calculate the value of PI by dropping a needle of length k
onto a grid of parallel lines whose length is greater than k.
The value is determined as the probability of hits (the needle crosses
a grid line) to the total number of tosses. This value is
PI = ( 2 * k * total-tosses) / number-of-hits
This calculation was simulated with a computer program.
The program was run on several platforms and processors.
I ran the simulation for 10 million tosses and a needle length of .8.
I assumed the grid lines to be one unit apart.
The results are given below.
Results of Buffon Needle Simulation
| || Pentium 133mhz || 486DX 120mhz
|| Sparc Ultra I || 486DX 66mhz |
| || DOS || Linux || Solaris 2.5 || DOS || Solaris 2.5.1
|| Linux |
| Time (seconds) || 57 || 32
|| 123 || 110
|| 47 || 145 |
| Value of PI || 3.163097 || 3.141706
|| 3.161965 || 3.163097
|| 3.161965 ||
Note the relatively poor values of PI for the DOS and Solaris OSes. Since
the simulation relies on a random number generator - the results reflect
a possible shortcoming (bug ?) in the generators. Hmmmm. Well boys and girls
we'll have to investigate further.
And for you linux supporters - it appears that linux on 133 pentium
beat out a Sun Sparc Ultra I (at least for this simulation which gets
the cosine of an angle for each toss of the needle).
For your amusement I have a new simulator - java applet to calculate PI
(I lost the original executable file)
Value of PI (to 10k places) is HERE
Next week there will be a test - to see if you have memorized the value.