One article to understand Pu Feng's needle injection experiment

This blog originated from the idea of ​​Monte Carlo method during the review of probability theory, this kind of finding π \piThe idea of π is very clever

Attachment: Historical record of using Pu Feng's needle throwing experiment to estimate pi, source
Insert picture description here

Pufeng needle

The Pu Feng needle throwing experiment was proposed by the French mathematician and natural scientist "Georges-Louis Leclerc de Pu Feng" in the 18th century.
The experimental method is extremely simple:

  • Take out a piece of white paper and draw a set of parallel and equidistant straight lines on the white paper.
  • Lay the paper flat, and randomly throw a needle with a length of half the line spacing on the white paper
  • Throw needles multiple times, record the number of times the needle crosses the line and the total number of needles, and finally divide to calculate the probability that the needle crosses the line

You will be surprised to find that this probability is the reciprocal of pi (1/π).
Pufeng's needle-throwing experiment is the first example to express a probability problem in geometric form. We can use this method to estimate pi

Pufeng needle throwing principle

As shown in the figure, construct a set of parallel lines,
Insert picture description here
throw some sticks (needles) at a distance of a , and a length of l.
Insert picture description here
Take the intersecting stick in the lower left corner as an example. Pick the midpoint and draw a line perpendicular to the parallel line below, and record the length as x ; The angle between this stick and the parallel line is φ \varphi
Insert picture description here
The requirement for the intersection of the φ stick and the parallel line is
x ≤ l ∗ sin φ 2 x\leq\frac{l*sin\varphi}{2}x2lsinφ
Why is this so? Next, let's continue the analysis. First draw a triangle, the hypotenuse is the stick l, and the bottom is the parallel line of the above figure (the simulation situation just crosses the parallel line)
Insert picture description here
If you want the lower boundary to intersect the stick, x must be less than l ∗ sin φ 2 \frac {l*sin\varphi}{2}2lsinφ, The upper boundary is the same. Here we must pay attention to understanding the definition of x.
Insert picture description here
Now that there is such a mathematical expression that can transform the problem of the intersection of the stick and the parallel line, we can then use mathematical methods to find the probability.
Insert picture description here
This involves some of the most basic solving knowledge of probability theory. , No more specific explanation

Next, we can use the area ratio to calculate the probability
Insert picture description here
. When the number of throws is large enough, we can also use the throw ratio to calculate the probability, which can be approximately equal.
Insert picture description here
So, when the length of the stick is only half the distance between parallel lines, you can directly use 1 π \frac{1}{\pi}Pi1Instead of probability, that is, π = 1 p \pi=\frac{1}{p}Pi=p1

I wrote it last year and found out that I didn’t post it, and I lost my draft box, hhh

Guess you like

Origin blog.csdn.net/wy_97/article/details/103448816