## Info

introduce the effect of the sinQ contribution. Because sinO to 90 degrees equals 1 to 0 (zero), line 30 changes the length of Y according to the value of sinQ. The random value of Y establishes the starting point of the needle, and D establishes the length of the needle. All of the needles are dropped perpendicular to the drawn lines even though various angle values for Q have been introduced into the computation.

A hit, or miss, is identified in lines 40 and 45. If a piece of the needle (a value of Y(I) ) coincides with a printed line, POINT (X,Y(I)) will be equal to -1 and a hit will be tallied. If no value of Y(I) coincides with a printed line, POINT (X,Y(I)) will return a 0 (zero) and a miss will be tallied. The needle is then SET and RESET in order to see it drop on the "plank." Lines 65 and 70 compute the value of pi and print both the current value and the cumulative value of pi over several sets of 100 trials. It takes about 40 seconds for 100 trials to be run and results computed.

The mathematical explanation in the 300-series lines may be omitted. However, they do present a synopsis of the mathematical reasoning involved in the program. This program is different from the other listings in this article. The others were trying to derive closer and closer approximations of the value of pi. Buffon's experiment provides a random opportunity for the correct value of pi to occur. I have seen close approximations after 30 drops and wide deviations from the true value after 300 drops. As you see the successive values of pi printed during the 100-trial sets, you will notice that they fluctuate around 3.14159... .

I wrote and tested these programs on a Model I, Level II TRS-80. I tested Listing 1 on a Model III Level II (at my friendly Radio Shack store), and the value given in Table 1 for 1000 trials was produced on it. I also tested Listing 1 (appropriately modified) on an Apple II Plus. The double-precision number capability made a difference of .000000078600599 when a sample size of 500 was used in both machines. The use of double-precision numbers uses up more memory space, but the accuracy of the results is increased.

### Summary

Pi, like some of the other odd numbers of mathematics, is an interesting enigma. These programs let your computer do the number crunching for you, and let you examine the effect of increasing the size of the sample run on the accuracy of the results.

While it is challenging to try to develop new infinite series to provide longer lists of pi's decimals, no more than 10 decimal places are needed for even the most precise practical applications. It has been stated that 10 decimal places would describe the circumference of the planet earth with an accuracy within a fraction of an inch.

Since van Ceulen devoted most of his life to pi, here are the first 20 fruits of his endeavor: PI= 3.14159 26535 89793 23846 ... .

Eves,

Bibliography Howard, An Introduction to the History of 0 0