Since making this video, we have created a new project called the Algorithm Archive and have added a chapter on Monte Carlo: www.algorithm-archive.org/chapters/monte_carlo/monte_carlo.html Please go there for information on how to code this up yourself!
That is exactly how I want the videos to be: As short as possible while still conveying the point. It takes forever to make 3 minutes of content, but that's alright.
After wasting an hour trying to understand an algorithm that shouldnt take more than 3 minutes to understand, I finally came across your video. You explained it perfectly. Thanks a lot
Monte Carlo methods are also very handy in game theory where it is easy to state the game rules, yet hard to precisely calculate the probability to win.
I made a long research to understand this topic and I can't reach to the nut... your video is very helpful , it summarise whole idea in simple concepts, thanx for ur efforts
The Batman example showed how to use Monte Carlo methods to find the area of a complex domain. More generally, we can think of integrating f(x) * p(x) where p(x) is a probability distribution. In your example f(x) is the indicator function of the batman logo and p(x) is the uniform distribution on the ellipse. But we could also extend this to something more complicated e.g. if f(x) = x and p(x) is the uniform distribution over the logo itself, we can find the center of mass of the logo. Or, if p(x) is not a uniform distribution, we can use importance sampling or Markov Chain Monte Carlo methods to compute the expected value of a function of a random variable. (commenting for other viewers - as a physicist I guess you already know this)
My grandfathers research on Monte Carlo numbers was actually pretty important. Look up Martin J Berger, his world is all available online and his obituary is achieved by the Washington post, is available through a simple search. I’m so proud of him.
This is an excellent explanation of a complex concept. I was glued to the video and understood every word. I wish I had you for my teacher when I was younger. I subscribed to your channel. I now want to learn everything you teach even if it just for fun. Its rare to find a teacher that explais a concpet to the core in a way that a layman understands.
I've always wanted to integrate odd shapes into a shooter videogame, for shotgun chokes. Maybe percent-error per shot can be used for boosting the unlucky shots, or the area-of-circumscribed-shape can be used to find the effectiveness of a shotgun choke, so the better ones cost more in a borderlands-style procgen. Also sometimes your videos make certain terms like integral wayyy less scary for someone like me, who has a lot of math left on their plate following high school and dropping college once. It's hard getting back into crowded class and math is totally smthn I don't want to fail. Ty
haha, I'm glad you liked it! I actually really like Monte Carlo. It was one of the first integration methods I learned and really helped me understand integration.
Great Video! After a one semester course on computational science and still not quite getting what this was all about your video really cleared things up! Thank you!
You sir should have more subs. The presentation of the concepts is super intuitive and easy to absorb thanks to the proper and simple explanations provided unlike the majority of college professors who unnecessarily complicate the matter due to their inadequate teaching skills. Sometimes I think that they became professors simply because they held 'PhDs'.
You're one of the few that don't say 'click like and subscribe'. Its because you don't need to because you're stuff is good. Hitting that subscribe button now.
Ah, thanks man! I don't tell people to like and subscribe because I hate watching people who say that. People know what to do. I don't need / want to tell them. I would honestly feel bad if people only subscribed to me because I told them to.
I used monte carlo integration in my masters thesis to approximate the volume contained in a specific electron density of a molecule. Advantage: You can get decent accuracy in a small amount of time. Disadvantage: If you need highly accurate values, it scales very poorly. To halve the area requires a squared number of points. Tesselation is better in pretty much every way
I have another question: Why does the sampling have to be random? Would using a grid of dense and equidistant points have the same effect? Also, can this work in 3D to find volume?
Super late response, but for reference for anyone who comes across this: because of the way it can be applied more universally than just this one scenario. Not all scenarios it can be used in have an equivalent concept of equidistant intervals. Additionally, not all functions you would want to test with Monte Carlo have clearly defined regions in values, and you might have an unknown amount of variance that you want to attempt to measure. As an example you can use it on physically based rendering (PBR) materials with randomly sampled surface normals (kinda surface facing direction) to measure average light influence. You don't know what a reflected ray would hit when bounced off in a specific direction so it makes more sense to average randomly distributed normals than even incremental changes in surface normals.
On one hand I'm really happy an algorithm like this exists and honestly sounds fun to code -- but from a mathematics standpoint I'm sad within programming there doesn't exist a more precise and less computationally straining way to find the area/volume/space taken up by these shapes :/
There is a problem with this method that gets over looked or ignored and that is related to how truely random your sample points are. Obviously the chalk dots on the chalk board is not really that random. A computer is pretty good however at creating a single random number, however when you create an iterative program that uses a random number function then you find the fact that your program is executing the random function at a regular sample rate the random function no longer appears to be truely random. You can try to improve things by adding a random delay in your program loop to avoid the regular sampling period and this can improve the apparent randomness but by simply scaling this random delay and then experimenting with different scaling factors you can find certain scale factors that clearly do not generate random scatter patterns.
Yeah. We definitely need to talk about randomness (Diehard tests, even). Thanks for bringing it back up to my attention. I'll bump this up on the list!
The quality of such simulations highly depend on the quality (mainly Periodicity) and implementation of your PRNG, in such a video you should always state which algorithm is used and from which lirary.
Alright! New video about Monte Carlo! This one was super fun to make (live on: www.twitch.tv/simuleios), especially the batman integration! Let me know what you think / if you have any comments, questions or concerns! Thanks for being awesome guys!
How do the dots know that they have been placed in the correct area? I mean, there must be an algorithm painting the dots green or red and based on that, derive the underlying distribution??
I have one question. If thinking about more complex function (still in xy-plane for simplicity) how do we know if the randomly selected dot is under the curve or over it? Like ofc we as humans can see it, but how to tell computer about it, how to code it in? Probably it is a stupid question, but it just popped into my head
May i know what software (for example, R, Matlab, python, etc) or platform you write codes on to carry out Monte Carlo simulations? Teacher LeiosOS, Thank you.
You can write monte carlo in any language and do similar visualizations with basic plotting software. Here's the relevant chapter on the Algorithm Archive: www.algorithm-archive.org/contents/monte_carlo_integration/monte_carlo_integration.html You can change the language at the top-left
Since making this video, we have created a new project called the Algorithm Archive and have added a chapter on Monte Carlo: www.algorithm-archive.org/chapters/monte_carlo/monte_carlo.html
Please go there for information on how to code this up yourself!
Thank you sir
this is the best mathematical education video I ever saw,short,simple,no overcomplicated shit,just straight to the point
That is exactly how I want the videos to be: As short as possible while still conveying the point. It takes forever to make 3 minutes of content, but that's alright.
Yolo Fapper Monte Carlo
Totally!
After wasting an hour trying to understand an algorithm that shouldnt take more than 3 minutes to understand, I finally came across your video. You explained it perfectly. Thanks a lot
I'm glad it was helpful! =)
Einstein once said "If you can't explain it to a 6 year old kid, your education about that topic in incomplete".
Great explanation
Einstein himself couldn't make understand scientists the Theory of relativity let alone a 6 years old kid.
@@phythematics2188 Lol.
I've been running through all youtube videos about his topic for hours and even the professor from MIT didn't answer my question. You are brilliant
Keep it up, you will hit youtube fame soon. Probably one of the best educators out there.
Thanks! I really appreciate it!
I was so scared that this video would be too complicated. Thank you so much for making it simple.
Monte Carlo methods are also very handy in game theory where it is easy to state the game rules, yet hard to precisely calculate the probability to win.
I made a long research to understand this topic and I can't reach to the nut...
your video is very helpful , it summarise whole idea in simple concepts, thanx for ur efforts
Yeah, there are a lot of concepts that seem super complicated at first glance, but are much easier after you get used to them a little.
The Batman example showed how to use Monte Carlo methods to find the area of a complex domain. More generally, we can think of integrating f(x) * p(x) where p(x) is a probability distribution. In your example f(x) is the indicator function of the batman logo and p(x) is the uniform distribution on the ellipse. But we could also extend this to something more complicated e.g. if f(x) = x and p(x) is the uniform distribution over the logo itself, we can find the center of mass of the logo. Or, if p(x) is not a uniform distribution, we can use importance sampling or Markov Chain Monte Carlo methods to compute the expected value of a function of a random variable. (commenting for other viewers - as a physicist I guess you already know this)
Yeah. I want to cover some of this stuff in the future soon (tm)!
My grandfathers research on Monte Carlo numbers was actually pretty important. Look up Martin J Berger, his world is all available online and his obituary is achieved by the Washington post, is available through a simple search. I’m so proud of him.
This is one of the best explanations for Monte Carlo I have found. Good job, James!
Very Nice. This is first time I understood Monte Carlo method clearly. Thanks for the video
omg!! dude you are definitely one of them! a rare bread of human beings who know how to explain things really well, congrats! (clapping)
Haha, I'm glad you like the content! =)
Let me know if you have any questions!
I most certainly will ..
This is an excellent explanation of a complex concept. I was glued to the video and understood every word. I wish I had you for my teacher when I was younger. I subscribed to your channel. I now want to learn everything you teach even if it just for fun. Its rare to find a teacher that explais a concpet to the core in a way that a layman understands.
I've always wanted to integrate odd shapes into a shooter videogame, for shotgun chokes.
Maybe percent-error per shot can be used for boosting the unlucky shots, or the area-of-circumscribed-shape can be used to find the effectiveness of a shotgun choke, so the better ones cost more in a borderlands-style procgen.
Also sometimes your videos make certain terms like integral wayyy less scary for someone like me, who has a lot of math left on their plate following high school and dropping college once. It's hard getting back into crowded class and math is totally smthn I don't want to fail. Ty
I'm happy this was useful! I'm interested to see how you work this out for your game. It could be really cool!
Awesome explanation! Finaly some non-boring video for numeric methods! :)
haha, I'm glad you liked it! I actually really like Monte Carlo. It was one of the first integration methods I learned and really helped me understand integration.
this is the coolest algorithm videos I've ever seen, better than most stuff in my uni
I was out there reading papers and falling sleep. You saved my day. Simply and elegant ~~~
I'm glad you liked it! When I saw this for the first time, I thought it was magic!
Great Video! After a one semester course on computational science and still not quite getting what this was all about your video really cleared things up! Thank you!
Woo! I'm glad it was helpful! =)
Short, simple, clear. Wow! Great video! I finally understand Monte Carlo simulations!
Yeah, it's crazy how random numbers can be so useful!
Concise+informative+to the point+easy example = My subscription!
This is an amazing explanation. Thank you!
You sir should have more subs. The presentation of the concepts is super intuitive and easy to absorb thanks to the proper and simple explanations provided unlike the majority of college professors who unnecessarily complicate the matter due to their inadequate teaching skills. Sometimes I think that they became professors simply because they held 'PhDs'.
I've seen the other videos of yours too. It'd be amazing if you were a professor. We need more people who teach in such simple and intuitive ways.
Honestly, I would love to be a professor. It's one of my dream jobs!
Awesome! The only video, that can deliver 4 minute content in around 4 minutes (and not 10, 20 or 50, like the other videos)
This is the best explanation of anything I've ever seen on youtube. Thank you!
Never seen a better explanation on anything, ever. Amazing videos, just found your channel :)
I'm glad it was useful! =)
It's amazing how many modern application use Monte Carlo! Great introduction video :D
Best Monte Carlo advertisement I've ever seen. The slogan @ 3:26 is great
I like my videos to advertise algorithms. It's better to motivate people to learn.
This is the best explanation I've seen on Monte Carlo so far
Dude, you explained such a concept in 3 minutes. That was amazing!
I'm glad it was helpful!
Very concise and straightforward explanation of monte carlo integration. Thank you
This is the best explanation on the internet, thanks a lot!!
I'm glad it was helpful!
Sir, I hope you read this comment. You are brilliant and kind. GOD bless You! Keep educating us like this Sir!
You're one of the few that don't say 'click like and subscribe'. Its because you don't need to because you're stuff is good. Hitting that subscribe button now.
Ah, thanks man! I don't tell people to like and subscribe because I hate watching people who say that. People know what to do. I don't need / want to tell them. I would honestly feel bad if people only subscribed to me because I told them to.
This channel is gonna touch the skies! I am happy that I am such an early subscriber!
Very much liked it....explained the complex definition very simply ...keep up the good work! :)
I'm super glad it was useful! =)
Thank you. Searching for so many sites but here I cleared my conception :)
Greatest explanation of Monte Carlo I've ever seen!
I'm glad you found it useful!
A lots of thanks for giving a valuable information.Please keep going on to do more and more videos with your amazing information.
thank you so much for explaining so well and concisely to beginners like us!
I'm glad it helped! =)
You earned a sub today, keep up these vids (along with algorithms) :D
Wow, you did that in less than 4 minutes. Bravo!
And that's another precious way of calculating pi :D
Many thanks Sir, you made as easy as could have been possible, I was watching MIT 's course for 55 min wasn't that clear as you were
Thanks a lot bro;Atlast I've found the platform for visualizing the concepts clear.Keep it up..
I'm glad it was useful! I've been trying to get more videos out, but with work and everything, it takes a little longer then I'd like...
This is absolutely brilliant ! What a simple and short explanation ! Thankyou so much
you are amazing, and also very vivid ways to tell others the simulation process.
I used monte carlo integration in my masters thesis to approximate the volume contained in a specific electron density of a molecule.
Advantage: You can get decent accuracy in a small amount of time.
Disadvantage: If you need highly accurate values, it scales very poorly. To halve the area requires a squared number of points.
Tesselation is better in pretty much every way
You conveyed the point very clearly.
An excellent excellent video, excellent explanation. Both liked and subscribed.
Very well explained the Jargon.
I'm glad it was useful!
Very nicely done!
Glad it was helpful!
I understand exactly about Monte Carlo calculation after seeing this video..many thanks!!
Great! I am glad it was helpful! =)
Simple, elegant and impactful!
I have another question: Why does the sampling have to be random? Would using a grid of dense and equidistant points have the same effect?
Also, can this work in 3D to find volume?
yes it does works in 3D
Super late response, but for reference for anyone who comes across this: because of the way it can be applied more universally than just this one scenario.
Not all scenarios it can be used in have an equivalent concept of equidistant intervals. Additionally, not all functions you would want to test with Monte Carlo have clearly defined regions in values, and you might have an unknown amount of variance that you want to attempt to measure.
As an example you can use it on physically based rendering (PBR) materials with randomly sampled surface normals (kinda surface facing direction) to measure average light influence. You don't know what a reflected ray would hit when bounced off in a specific direction so it makes more sense to average randomly distributed normals than even incremental changes in surface normals.
@@mettaursp309 that makes sense, thanks!
you are going places my dude, keep it coming!
On one hand I'm really happy an algorithm like this exists and honestly sounds fun to code -- but from a mathematics standpoint I'm sad within programming there doesn't exist a more precise and less computationally straining way to find the area/volume/space taken up by these shapes :/
To be fair, there are plenty of algorithms that are more precise than Monte Carlo. It's just a really cool algorithm!
There is a problem with this method that gets over looked or ignored and that is related to how truely random your sample points are. Obviously the chalk dots on the chalk board is not really that random. A computer is pretty good however at creating a single random number, however when you create an iterative program that uses a random number function then you find the fact that your program is executing the random function at a regular sample rate the random function no longer appears to be truely random. You can try to improve things by adding a random delay in your program loop to avoid the regular sampling period and this can improve the apparent randomness but by simply scaling this random delay and then experimenting with different scaling factors you can find certain scale factors that clearly do not generate random scatter patterns.
Yeah. We definitely need to talk about randomness (Diehard tests, even). Thanks for bringing it back up to my attention. I'll bump this up on the list!
great, easy, and fast explanation. exactly what I needed :))
Thank you.
Great to hear!
The quality of such simulations highly depend on the quality (mainly Periodicity) and implementation of your PRNG, in such a video you should always state which algorithm is used and from which lirary.
Agreed
Alright! New video about Monte Carlo!
This one was super fun to make (live on: www.twitch.tv/simuleios), especially the batman integration!
Let me know what you think / if you have any comments, questions or concerns!
Thanks for being awesome guys!
Omg i just discover your videos and they’re amazing, thanks for share.
Nice video!. the explanation was easy and understandable.
concise and entertaining. thanks!
Nice video. I'm surprised it doesn't have more views
Really nice! Easy to understand!
A thorough explanation. Thanks!!
I should've found this video several hours ago! Nice!
I'm glad it was helpful!
Great explanation, thanks!
Short, sweet & amazing!
Thank you so much. You explained it with simplicity.
very nice explanation, appreciated..
I'm glad it was helpful!
This is exactly what I was looking for! thanks :)
At last I understood monte carlo simulation. Thanks :)
I'm glad it was helpful!
How do the dots know that they have been placed in the correct area? I mean, there must be an algorithm painting the dots green or red and based on that, derive the underlying distribution??
So for the circle example, all we did was check wether x^2 + y^2
Thank you!
What I was thinking, doesn't the function to determine whether the dots are inside the area already assumes a lot of information about the area?
Well done! You are a great teacher.
I'm glad you found it useful!
a great touterial .i was wonder if there is a wan on MCMC method ??
Eventually, I would love to!
I have one question. If thinking about more complex function (still in xy-plane for simplicity) how do we know if the randomly selected dot is under the curve or over it? Like ofc we as humans can see it, but how to tell computer about it, how to code it in? Probably it is a stupid question, but it just popped into my head
This was really cool. You explained it so nicely. Gracias :)
Not bad. You could have mentioned how the points are actually sampled though (how they’re uniform. And are there nonuniform uses?)
Thank you for this great video. I will read more about it.
Very nice Explanation ! Thanks a lot!
Thanks! I am glad it was useful!
May i know what software (for example, R, Matlab, python, etc) or platform you write codes on to carry out Monte Carlo simulations? Teacher LeiosOS, Thank you.
You can write monte carlo in any language and do similar visualizations with basic plotting software. Here's the relevant chapter on the Algorithm Archive: www.algorithm-archive.org/contents/monte_carlo_integration/monte_carlo_integration.html
You can change the language at the top-left
@@LeiosLabs Got it. Thank you so much.
2 sec of this vid and u got a new suscriber !
Great explanation! Thank you!
Great Explaination!
Very well done
I just want to thank you for this great video. Also, I took sometime to visit the Arcane Algorithm Archive, very nice work!! Congratulation!!
I still don't understand one thing, why use random points instead of a uniform grid of points? what is the advantage?
Amazing explanation! Subscribed :)
Thank you for making this video!!
Best educator out there on UA-cam. Not far from being famous
I'm glad you found it useful! =)
So how does the program know whether a random point is in the region we what to integrate over?
Beautiful! Beautiful! Beautiful! Beautiful!............. till forever ends..................
Thank You!
Haha, I'm glad it was useful! =)
At 2:49, the Percent Error jumps to 4 percent for a short time.
Can someone please explain it?
@Ayush Agarwal it's not 4 percent but 4.30429e-05 which corresponds to 0.0000430429
@@ugururesin8405 Oh! My Bad!
Thanks for correcting me.
Simply AWESOME
Yeah, batman took a while...
i am soooo thankful
Thank you so much for this explanation. your student from Algeria
Awesome video!! Thank you for posting. Harvard MIT should have you as teacher...quant education will be lot more enjoyable!!
I'm still a few years off of my PhD. I'd love to be a professor at some point, though!