de-buffon-needle/README.md

26 lines
788 B
Markdown
Raw Permalink Normal View History

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
2014-01-14 20:29:48 +01:00
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
2014-01-13 22:01:52 +01:00
http://www.gnu.org/licenses/gpl.html