This video has nothing to do with Good Will Hunting and/or Matt Damon. Just using random sampling and monte carlo to approximate pi.
Пікірлер: 61
@XanderGouws6 жыл бұрын
*draws circle "This is a square"
@Eniro205 жыл бұрын
It's an approximation!
@J.P.Nery.N.5 жыл бұрын
Parker square!
@samkonstan52544 жыл бұрын
Subduralempyema the new sinx=x
@TRex2666 жыл бұрын
I wrote a parallel C++ version and ran this on my Uni's computing cluster across 1000 cores with 5*10^14 sample points in total (took just under 8 hours) and I only got the first 6 digits right. Looks like it doesn't scale as well as you thought :D
@someguy90464 жыл бұрын
"how to estimate pi" Say the word "three" Job done
@lnhostetler4 жыл бұрын
How I approximate pi in Python: import numpy as np print(np.pi) But sure, I suppose a Monte Carlo approach works too :D
@johnchristian50276 жыл бұрын
One of the first things I did when learning how to code in python was approximating pi, its a good exercise! Great Video!
@calebwhales6 жыл бұрын
Thanks for this Andrew. As someone learning Python its great to see it's very casual usages, and the lines as thought out in real time. Numerical integration would be great.
@AndrewDotsonvideos6 жыл бұрын
Awesome! Good luck with python!
@josesierra87936 жыл бұрын
This is awesome andrew. I dont even know anything about coding, but i enjoy math, and you make it easy to understand whats going on with your work. Excellent job, man.
@AndrewDotsonvideos6 жыл бұрын
Means a lot! THank you!
@saavestro21546 жыл бұрын
>"Hi and welcome to numberphile" >camera zooms in on the fase of some sperglord already covered in sweat >"Today we are going to talk about the number five" >sperglord smiles the smile of a thousand suns >drops of sweat pouring from his forehead >he writes the number five on a paper >"The amazing thing about this number is that it is a part of you" >camera zooms in on his hand that is soaked in sweat and shaking uncontrolably >"As you can see my hand contains five fingers" >a tear falls from his eye >"I would not even know what to do with myself if not for five" >looks at the camera like he is seeing god >tears of joy raining down his cheeks >In a shaky voice he says: >"Without five I couldn't even count to six!" >begins to cry
@imadmorsli28714 жыл бұрын
Based and gay
@perigrinus31334 жыл бұрын
lol i saw seen this meme a while ago. thank you for reminding me of it.
@CarlosKoji876 жыл бұрын
Using the Monte Carlo Method for numerical integration would seem like a really awesome video to make. I've seen it used for the Brachistochrone problem when I was doing an experimental physics project in MatLab a couple years back.
@sjgabhane6 жыл бұрын
Great Video!! more videos like these please
@thiagocalomino2762 жыл бұрын
Cool! Helped me a lot in Numerical Methods at college, thanks. I'm from Brazil!
@anshsrivastava10595 жыл бұрын
I increased N to be around 100000000000000000000000000000 and my computer crashed.
@rahil_rehan5 жыл бұрын
As every point lies in a square, there shouldn't be an if else statement, coz the coordinates get added to square coordinates if they are not in a circle. But all the points do lie in the square, well the output would be right still as you tool float(N) at last computation.
@ajonautajo6 жыл бұрын
Literally did the same project about a year ago. Lent itself to a some statistic analysis to improve the approximation. Good stuff though.
@natmath25766 жыл бұрын
That was a real Parker Square
@ratulbanerjee84564 жыл бұрын
I think just use Ramanujan or any other fundamental series approx formulaes and will give digits upto ones will.
@UrsielHauke4 жыл бұрын
1:46 we can stop here, that's a good estimation
@BeLikeNexus4 жыл бұрын
God this mans beard is perfect
@autid6 жыл бұрын
First thought: Monte Carlo? 3:50 Monte Carlo!
@lyndonhanzpernites58603 жыл бұрын
same!
@aritraray25014 жыл бұрын
what if I take the random variables range as (0,2) for both x and y??..its not going to give the right value..but i cant understand why
@coltonhassel25296 жыл бұрын
Hey just wondering what packages would you recommend installing for these types of things in Jupyter
@AndrewDotsonvideos6 жыл бұрын
Can't go wrong with numpy, scipy, sympy, and matplotlib. But I also think those come with anaconda.
@zoltankurti6 жыл бұрын
I think generating points in a grid like you had shown in the beginning and than counting them would be more accurate. Also, using only a quarter circle is 4 times faster but has the same precision. Then again, you could write a simple program to integrate sqrt(1-x^2) by divideing it into small rectangles. This could be a part two of this wideo, since it is very useful to see how numerical integration works. You can also better understand the definition of a Riemann integral by this example.
@expertnonexpert38263 жыл бұрын
is there a book that covers this material. like what "append" means etc? I got "Doing Math With Python" but it seems very basic.
@electrikshock29506 жыл бұрын
You can also get the root of the sum of 6/x^2 and you will get to pi at infinity (or pretty close with a very high number) or this pattern [ (-1)^(x+1)/2x-1 ]
@kamehamehaDdragon6 жыл бұрын
Great video man, I'm looking foward to learn python, i only know how to code on Java a little, python looks very different but the kind I like.
@SolathPrime3 жыл бұрын
God bless you
@carlosvargas29076 жыл бұрын
Great
@amandeep99303 жыл бұрын
What about using various infinite series representations of pi?
@Thegreatnintendolets5 жыл бұрын
I think an easier way wouldve been to use the series for arctanx and have it iterate n amount of times to give an approximation
@jessicachaves36663 жыл бұрын
thanks :D
@uminum16 жыл бұрын
"..... Cool!"
@XanderGouws6 жыл бұрын
Why couldn't you just use a for-loop? Also, could you do a vid implementing monte-carlo in python?
@AndrewDotsonvideos6 жыл бұрын
for loop, while loop, doesn't matter. And I'm thinking about it
@XanderGouws6 жыл бұрын
Andrew Dotson ye but using a while loop there is _filthy_
@Econcrafter5 жыл бұрын
@@XanderGouws Exactly my thoughts
@andree20620124 жыл бұрын
Depends on the general length of the program you do but from an performance point of view, an for loop is much better. Also great video man but your coding style made me cringe a bit :))
@andrewtran66696 жыл бұрын
When did you start learning Python?
@AndrewDotsonvideos6 жыл бұрын
Wow only a year ago now that I think about it.
@principia13723 жыл бұрын
14:55 CMBR???
@illumiyokai6 жыл бұрын
First
@kathanshah83053 жыл бұрын
Tl Dw answer is 3
@matron99364 жыл бұрын
If this is a square then pi equals to 4. Now i am know how engineers think.
@samkonstan23334 жыл бұрын
I’ve got another way that’s a lot simpler. print(3)
@nirorit4 жыл бұрын
Why throw darts at random? Can't you just spread the darts evenly to get an absolutely converging sequence?
@matron99364 жыл бұрын
Video start: This is a square. Close video.
@ISapTout6 жыл бұрын
Please, for the love of God, shave that beard. Great video.
@someaccount34385 жыл бұрын
This video is pointless. Everyone knows π = 3.
@chillfill48664 жыл бұрын
Stupidest thing I've ever seen. Non deterministicly approaches pi in 2*10^n multiplications where n is each digit of precision. Archimedes did it better 1000s of years ago.