2014-01-13 22:01:52 +01:00
|
|
|
# Ago di Buffon
|
2013-01-05 02:59:22 +01:00
|
|
|
|
2014-01-13 22:01:52 +01:00
|
|
|
## Simulation of de Buffon's needle method in python 3.
|
2013-01-05 02:59:22 +01:00
|
|
|
|
2014-01-13 22:01:52 +01:00
|
|
|
### 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.
|
2013-01-05 02:59:22 +01:00
|
|
|
|
2014-01-13 22:01:52 +01:00
|
|
|
It is set with the "estimation" of Lazzarini for better results.
|
|
|
|
The best find was a difference of `8*10^-6`.
|
2013-01-05 02:59:22 +01:00
|
|
|
|
2014-01-13 22:01:52 +01:00
|
|
|
### 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
|