Simulation of de Buffon's needle method
.gitignore | ||
de Buffon.py | ||
README.md |
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