For anyone interested in coding it up, a simplified scenario is (to guarantee closeness to the line and to ignore the mirror symmetry) to take a uniformly random x from [0,1) and theta from [0,pi/2), then you count a success if x + sin(theta) >= 1. The probability of success is still 2/pi. Note that sin and cos are interchangeable here.
Fun fact: The same formula holds even when the needle isn't a straight line, except it gives the _expected number_ of crossings; the intuition being that if your "needle" has the same length but is really curled up, it will be less likely to intersect a line but when it does, it will usually intersect it more than once.
Theres another pi formula which uses arctan, similar to the 1-1/3+1/5-... one. It is pi = 16arctan(1/5)-4arctan(1/239), and was used to calculate pi to 527 digits, which is the world record for calculating pi by hand. Could you maybe do a video on a geometric proof of this? Because I have no idea where it comes from.
The formula uses probability. how can we express this as a counting problem? The number of toothpicks that intersect a line vs the total number of toothpicks? and the lined paper needs to be large enough so that every toothpick lies between two lines right?
The integral of arccos(x) from 0 to 1 is the same as the integral of cos(x) from 0 to pi/2, which makes the calculation much easier. (Convince yourself graphically)
There is a simpler random way to calculate pi by throwing arrows at a circle bounded by a square, and calculating pi from the ratio of the arrows inside the circle. Not only it's much simpler, simulating it does not require usage of pi or trigo functions - just random numbers, substruction and multiplication
Another wonderful video from my favorite math tutor. You're one of the reasons i fell in love with math and now i study it for the beauty not just the marks. Major thanks dr trefor
It's lovely maths, but lacks a certain practicality. Modelling it as a random walk suggest that the error should be 1/sqrt(n) so for 3 decimal places something like 1,000,000 throws would be needed. ... but we are in the company of mathematicians, why worry about such mundane issues.
If you toss as many toothpicks as there are lines on the page is there some connection with 1/e ? I keep trying to find ways to visualize the constant e but so far I've been told a catenary arch or a hanging chain are the only things that sorta get close.
At the start of the video, the second = is also an "approximately", because you swap out a mathematical probability for its observed frequency. It's also probably not so easy to guarantee that the angles and positions are uniformly distributed on the range, but sample size is probably a much more relevant concern for a trial by hand anyway.
Hey man! This was a really nice simple and elegant proof. Side note: the chapter of "deriving the formula" was spelt as driving the formula, otherwise, great vid!
I liked your analysis of this method to “compute” pi …. But the glib comment about just running a computer a million samples is fraught with danger. It’s very easy with this type of problem to run into problems with the random number generator used … first you need random pairs of numbers (x and theta), something an a lot of pseudo random number generators are very bad at, second it can be fairly easy to exceed the actual length of the generator is capable of generating i.e. its period. Many modern tools and computer libraries have generators that greatly reduce these issues and very many do not. A fun exercise is to calculate the convergence rate and the compare the analytical results to a computer experiment. The convergence rate is quite slow no surprise, but often the computer results stops improving after a surprising small number of trials.
Fun stuff, but there’s an issue with your computer simulation. I suspect that pi exists somewhere in your code (or in the machine code for one of the functions you use). Could someone program a needle dropping simulation that calculates pi without already knowing pi?
The pi is purely emergent here. The simulation works by randomly choosing an x and y coordinate of midpoints from the square, randomly choosing a rotation angle, and then counts them up.
For anyone interested in coding it up, a simplified scenario is (to guarantee closeness to the line and to ignore the mirror symmetry) to take a uniformly random x from [0,1) and theta from [0,pi/2), then you count a success if x + sin(theta) >= 1. The probability of success is still 2/pi. Note that sin and cos are interchangeable here.
Very unrelated but nice haircut dude! Whatever your latest look is looks very clean and sharp
Ha thank you! That is my wife’s amazing handiwork:D
That is some hilarious T-shirt!
"sinx = opposite/hipopotamus"
haha I love it:D
Fun fact: The same formula holds even when the needle isn't a straight line, except it gives the _expected number_ of crossings; the intuition being that if your "needle" has the same length but is really curled up, it will be less likely to intersect a line but when it does, it will usually intersect it more than once.
so do you count the number of crossings? That's going to jack up my error estimate, as it's now a Poisson process.
Theres another pi formula which uses arctan, similar to the 1-1/3+1/5-... one. It is pi = 16arctan(1/5)-4arctan(1/239), and was used to calculate pi to 527 digits, which is the world record for calculating pi by hand. Could you maybe do a video on a geometric proof of this? Because I have no idea where it comes from.
I believe that family is all coming from the Taylor series for arctan
Is this one of the ways of using monte carlo method to approximate π?
Hi Dr. Bazett!
Very cool!
Since one toothpick is a Bernoulli process, you get a binomial distribution, and the square of the uncertainty goes as P(1-P)/N.
The formula uses probability. how can we express this as a counting problem?
The number of toothpicks that intersect a line vs the total number of toothpicks?
and the lined paper needs to be large enough so that every toothpick lies between two lines right?
Exactly!
That is very cool
The integral of arccos(x) from 0 to 1 is the same as the integral of cos(x) from 0 to pi/2, which makes the calculation much easier. (Convince yourself graphically)
Absolutely!
Before I liked, you'd got 314 likes, wow!
Haha that’s awesome
There is a simpler random way to calculate pi by throwing arrows at a circle bounded by a square, and calculating pi from the ratio of the arrows inside the circle. Not only it's much simpler, simulating it does not require usage of pi or trigo functions - just random numbers, substruction and multiplication
Another wonderful video from my favorite math tutor. You're one of the reasons i fell in love with math and now i study it for the beauty not just the marks. Major thanks dr trefor
Wow, thank you!
@DrTrefor Yes thanks for sharing Dr Trefor. I really hope you can respond to my other comment when you can. Thanks very much.
It's lovely maths, but lacks a certain practicality.
Modelling it as a random walk suggest that the error should be 1/sqrt(n) so for 3 decimal places something like 1,000,000 throws would be needed.
... but we are in the company of mathematicians, why worry about such mundane issues.
Pi is Cool and all but I can't take my eyes away from that cute Hippopotamus.
lol:D
If you toss as many toothpicks as there are lines on the page is there some connection with 1/e ? I keep trying to find ways to visualize the constant e but so far I've been told a catenary arch or a hanging chain are the only things that sorta get close.
I don’t think so, the rotations of the toothpicks make it reasonable that pi is involved but I can’t see an e
Maths is life
Amazing!
At the start of the video, the second = is also an "approximately", because you swap out a mathematical probability for its observed frequency.
It's also probably not so easy to guarantee that the angles and positions are uniformly distributed on the range, but sample size is probably a much more relevant concern for a trial by hand anyway.
Hey man! This was a really nice simple and elegant proof. Side note: the chapter of "deriving the formula" was spelt as driving the formula, otherwise, great vid!
I liked your analysis of this method to “compute” pi …. But the glib comment about just running a computer a million samples is fraught with danger. It’s very easy with this type of problem to run into problems with the random number generator used … first you need random pairs of numbers (x and theta), something an a lot of pseudo random number generators are very bad at, second it can be fairly easy to exceed the actual length of the generator is capable of generating i.e. its period. Many modern tools and computer libraries have generators that greatly reduce these issues and very many do not. A fun exercise is to calculate the convergence rate and the compare the analytical results to a computer experiment. The convergence rate is quite slow no surprise, but often the computer results stops improving after a surprising small number of trials.
Ah I was trying to recall this to prove the quantum version of pi - quantum length and angle from measurement 'noise'
Fun stuff, but there’s an issue with your computer simulation. I suspect that pi exists somewhere in your code (or in the machine code for one of the functions you use). Could someone program a needle dropping simulation that calculates pi without already knowing pi?
The pi is purely emergent here. The simulation works by randomly choosing an x and y coordinate of midpoints from the square, randomly choosing a rotation angle, and then counts them up.
First
Wow you are fast!
You are such an amazing teacher. I really learn a lot from your lectures. Do you have an IG or Facebook?