a reproducible gallery of statistical graphics
Given a needle of length dropped on a plane ruled with parallel lines units apart, what is the probability that the needle will cross a line? This question is first posed in the 18th century by Georges-Louis Leclerc, Comte de Buffon. The answer is where is the distance between two adjacent lines, and is the length of the needle.
The solution, in the case where the needle length is not greater than the width of the strips, can be used to design a Monte Carlo method for approximating the number .
In the animation package, the function buffon.needle()
can be
used to simulate Buffon’s needle. There are three graphs made in each step: the top one is a
simulation of the scenario, the bottom-left one can help us understand the connection between
dropping needles and the mathematical method to estimate , and the bottom-right one is the
simulation result for each drop.
You can use larger nmax
values in the code to drop the needle for more times.