====== Buffon's Needle ======
In mathematics, Buffon's needle problem is a question first posed in the 18th century by Georges-Louis Leclerc, Comte de Buffon:
> Suppose we have a floor made of parallel strips of wood, each the same width, and we drop a needle onto the floor. What is the probability that the needle will lie across a line between two strips?
Using integral geometry, the problem can be solved to get a Monte Carlo method to approximate $\pi$.
===== Mathematical Theory =====
FIXME
===== Animation =====
The animation below contains 100 frames which might take several seconds to load, so please be patient for waiting.
There are three graphs made in each step: the top-left one is a simulation of the scenario, the top-right one is to help us understand the connection between dropping needles and the mathematical method to estimate $\pi$, and the bottom one is the result for each dropping.
===== R code =====
oopt = ani.options(nmax = 500, interval = 0)
ani.options(nmax = 100, interval = 0.1, ani.height = 500, ani.width = 600,
outdir = getwd(), title = "Simulation of Buffon's Needle",
description = "There are three graphs made in each step: the top-left
one is a simulation of the scenario, the top-right one is to help us
understand the connection between dropping needles and the mathematical
method to estimate pi, and the bottom one is the result for each
dropping.")
ani.start()
par(mar = c(3, 2.5, 1, 0.2), pch = 20, mgp = c(1.5, 0.5, 0))
buffon.needle(type = "S")
ani.stop()
ani.options(oopt)