====== 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 =====
library(animation)
saveHTML({
    ani.options(nmax = 500, interval = 0)
    ani.options(nmax = 100, interval = 0.1)
    par(mar = c(3, 2.5, 1, 0.2), pch = 20, mgp = c(1.5, 0.5, 
        0))
    buffon.needle(type = "S")
}, img.name = "buffon_needle", htmlfile = "buffon_needle.html", 
    ani.height = 600, ani.width = 600, outdir = getwd(), title = "Simulation of Buffon's Needle", 
    description = c("There are three graphs made in each step: the top-left\none is a simulation of the scenario, the top-right one is to help us\nunderstand the connection between dropping needles and the mathematical\nmethod to estimate pi, and the bottom one is the result for each\ndropping."))