de-buffon-needle/README.md
Michele Guerini Rocco a51d497e2f Fixed layout
2014-01-14 20:29:48 +01:00

788 B

Ago di Buffon

Simulation of de Buffon's needle method in python 3.

Info

A simple module to estimate π using the Buffon's needle method. With Turtle graphics a floor is generated and needles are randomly drawn. If a needle crosses the axis it turns red and it is counted. The estimated value of π is continuously printed and at the end the deviation from the real value is shown.

It is set with the "estimation" of Lazzarini for better results. The best find was a difference of 8*10^-6.

Usage

Parameters:

X, Y: axes lenght;
T: distance between parquet's axes;
L: length of the needle;
N: number of iterations.

License

Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html