Damn, this was the clearest explanation I've seen on this stuff. Well done !
@Softdattel Жыл бұрын
Very good introduction to monte carlo. You are doing a great job, clear concise, spiced with a little humor, no unrelated story telling! Keep it up. Thanks.
@jursamaj Жыл бұрын
6:40 A better method: only generate your x samples. For each x, calculate the y (you're already doing this to decide if an x,y sample is inside or not, so this is the same efficiency). Add all of your y values to a floating point accumulator. At the end, divide the accumulated value by the number of samples to get an average height, and multiply by the width of the domain (10-1=9). You don't even need to know the maximum height this way. In practice, you wouldn't even use random x values, but equally spaced ones. In fact, I whipped this up in Python, and got the answer correct to about 1 part in 10^12, compared to yours at 1 part in 1^4.
@hansisbrucker8139 ай бұрын
Do you happen to have the code somewhere. You made me really curious 🤓👍
@mateuszkujda35444 жыл бұрын
I never write comments on yt, but I would like to thank the universe for bringing me to your channel and enjoying listening about the math and solving the problem. Good job man!
@francissydnor78914 жыл бұрын
Absolutely incredible explanation. The world needs more people who can teach material like you can. Cheers!
@edgo66322 ай бұрын
Best vid on Monte Carlo sim on KZbin. Hope this guy is making millions by now
@TrueTalenta2 жыл бұрын
Has anyone told you that you are just phenomenal and exceptional in your explanations! Great job!
@bigh84383 жыл бұрын
This came up on my timeline. I use a representation of the Monto Carlo method for nuclear simulations at uni
@ear4funk8144 жыл бұрын
Yep ... definitely clearest example of Monte Carlo Integration I've seen .... great job, and most appreciated!!!!
@johnburns96969 ай бұрын
I really enjoyed your explanation of using Monte Carlo simulation to solve an area under the curve problem. Cheers!
@jeshurunjohnson132 жыл бұрын
Thank you so much! I was stuck on a piece of code involving Monte Carlo simulations for days!
@rafshantik3 жыл бұрын
Such clear pronunciation of scientific terms. How do I talk like you? I always forget what I am going to say whenever giving presentation.
@pythonanimalia5 жыл бұрын
new to python. I like that the syntax suggestions pop up while you type. What are you using?
@adinathdesai68802 жыл бұрын
Thanks a lot, it really helps me to understand the concept and method of Monte Carlo method
@pacersgo3 жыл бұрын
In this example you don’t need to use MC. If you simply sample grids in very fine resolution, you can get the same results
@PintuBhattacharya-mp4mw3 жыл бұрын
Nicely explained. Requeting for an another video on integration of a 3-variable function.
@anandrai4922 жыл бұрын
Brilliant! So clear and concise, thank you so much.
@iidtxbc2 жыл бұрын
Can you do "Quasi Monte Carlo"?
@peterchindove71462 жыл бұрын
Totally enjoyed your presentation, kudos!
@rezakhalili53623 жыл бұрын
You're the best. It was so clear to me. unfortunately it wasn't what I wanted. But that made a good vision of this method
@stonecastle858 Жыл бұрын
Very well explained. Brilliant
@totimariageraci Жыл бұрын
Great clear explanation, thank you so much
@gutzimmumdo4910 Жыл бұрын
very clear explanation
@jagarali6 жыл бұрын
This is a quite exhaustive explanation.. Thanks.
@renanlarrieu2 жыл бұрын
Clear and well done explanation. Thank you
@darcash1738 Жыл бұрын
in python you should use a for loop, oh yeah plus for loops are faster
@KeesJansma76894 жыл бұрын
Thanks for this clear explanation! You're a funny cool dude as well.
@OfufualuaguAugustus Жыл бұрын
Thanks for the video...I want to change the co so I can have several experiments and try them on a graph. How do I do so?
@spyhunter0066 Жыл бұрын
excellent job, well done!
@Pradeepvlogs1014 жыл бұрын
So clear explanation! Thanks
@IbnuNurHamzah4 жыл бұрын
thanks for your explanation dude
@emrulhasan56463 жыл бұрын
Awesome explanation. Loved it. Thanks a lot!
@p.s.srinivas76964 жыл бұрын
Well explained. Concept became very clear.
@seandroid884 жыл бұрын
Thanks this really helped understand the monte carlo question on my final
@boomsaway36 жыл бұрын
yoo thank you for this video, helped me so much. i dont get why university lectures always over complicate things so annoying haha
@donharrold13754 жыл бұрын
It’s pathetic, but they’d rather seem smart than educate you.
@LegitPizzza5 жыл бұрын
A very clear and concise video, thanks a lot for the explanation.
@austinjohn87134 жыл бұрын
Thank you very much for making me understand what monte carlo methods are. The use of repeated random number generation combined with probability to provide numerical solutions to problems. Please you are calling the random generator twice in each loop iteration and therefore 2 million times by the time the loop is over . That is expensive. rather generate two sets of 1 million random numbers for x and y then traverse them in the loop. that way the random generator is called just twice
@Throwingness2 жыл бұрын
Magnificent explanation and demo. Did you know you can write 1000000 as 1_000_000 in python?
@entoris4767 жыл бұрын
This method is obviously quite bad to use when the region probability is quite small, then you'd need to make the 'box' a bit more of an exotic shape to increase the probability...
@RandomMathsInc7 жыл бұрын
Making the box more exotic-shaped, however, would mean it wouldn't be so simple to calculate the area of the box anymore.
@Santeca93re5 жыл бұрын
Guernsey island
@Danny-ts7sc4 жыл бұрын
thank you, your explanation is way better than my teacher
@sirknightartorias682 жыл бұрын
Bro, u are AMAZING ⭐
@sergiovazquez26624 жыл бұрын
Cheers man!! Great explanation for MC Method, and nice RP speaking!
@thehimalayan70416 жыл бұрын
very good, continue for next viedeo on mente carlo method .............I am waiting
@marceloescobar63893 жыл бұрын
Brilliant, absolutely brilliant
@dr.md.mehboobalam932 жыл бұрын
very nice video. I was thinking if we don't know the maximum value of the function then how do you call the random number for y?
@izzyt22862 жыл бұрын
THIS WAS AMAZING THANK YOU
@marcusseidowski33204 жыл бұрын
Well Done and well explaned!!Amen!Can you do something concerning subset simulation or importance sampling?
@matteofalduto7663 жыл бұрын
The initial dart example is, in general, correct for a multivariable function. But the example of the logx/x is misleading, as you turn a single variable function with a single variable domain, into a 2 variable scenario. The correct way of explaining a Monte Carlo integration in 1D would be showing how the average of f(x) over a wide set of random x (in other words the average value of the graph) is equal to the area divided by the width of the domain... Said differently: the area of the graph over a given domain is the same as the area of a rectangle that is as wide as the domain, and as high as the average value of your function.
@peterchindove71462 жыл бұрын
There are two variables x and y =f((x).
@matteofalduto7662 жыл бұрын
@@peterchindove7146 Well, y is a dependent variable, it doesn't count in this sense. You have only one independent variable over which you integrate, that's x. For example, a multivariable function would be something like z = f(x,y).
@peterchindove71462 жыл бұрын
@@matteofalduto766 So ..the generated random number (r) is the other independent variable at x (let's call it r_x), within the domain...which you compare to lnx/x ( ie r_x >? lnx /x ). Am l helping?
@chdfnh4 жыл бұрын
Very good explanation. Thanks!
@skilz80984 жыл бұрын
Very nice and simple explanation and demonstration through the use of python. Your algorithm worked quite nicely, however, the source code itself was written in a manner that was designed specifically for this problem... In other words, it's not exactly reusable. I've just written an integrator class in C++ that will calculate the integral of a function using Riemann Sums approximation. I was looking to extend my class to use other methods as well, Monte Carlo being one of them. I'm looking for a generic way to design the Monte Carlo method where the only information the integrator will have is the function of integration (its integrand), the limits of integration, and the step_size! The step_size within the context of Riemann Sums is the "width" of dx where that is defined by (upper - lower)/step_size where upper and lower are the bounds or limits of integration. Your video has given me some insights and it is still useful because I can always apply this technique to some Python source, but as for generating a generic reusable algorithm in C++... I still need to do some more research... Keep up the good work. Also, your video was a bit entertaining too!
@darcash1738 Жыл бұрын
I just generalized it in Python. Wasn't bad at all: import numpy as np def func1(x): return np.log(x) / x def integrating_carlo(runs: int, function, x_bounds: tuple, y_bounds: tuple): in_area = 0 box_area = np.abs((x_bounds[1] - x_bounds[0]) * (y_bounds[1] - y_bounds[0])) for i in range(runs): x_cord = np.random.uniform(x_bounds[0], x_bounds[1]) y_cord = np.random.uniform(y_bounds[0], y_bounds[1]) if y_cord < function(x_cord): in_area += 1 return (in_area/runs) * box_area xb1 = (1, 10) yb1 = (0, 1/np.e) print(integrating_carlo(1000000, func1, xb1, yb1)) Ok, so the x bounds are simply the bounds of integration, I'm gonna have to come up with another function so I can find the min and max for the function tho so you don't have to manually put in the y-bounds. I know how the math works, idk how to code it at this point tho. Find all f'(x) = 0 and f''(x) and that point to see if min or max. Not sure how to code out derivatives ngl. In the end, I just checked min and max the normal way, tho it does compromise on some degree of accuracy
@jonavuka4 жыл бұрын
so what if you randomly generated a point twice or more than once for your simulation? Is that not considered or is that attributed to the error
@vishalsk83373 жыл бұрын
Amazing work!
@vishalsaini50213 жыл бұрын
Greetings of the day sir...... Could you please make a video on how to consider uncertainty in big data such as solar radiation of 8760 hours with the help of Monte Carlo simulation
@rockandrolldevil6654 жыл бұрын
Thanks, that was an awesome class!
@donharrold13754 жыл бұрын
Seems like a massive amount of effort when a more straightforward numerical integration would be a lot quicker, i.e. divide the X axis into intervals (strips) between the limits of interest, calculate the Y value at the mid point of each interval and calculate the area of each rectangular strip under the curve. Sum the area of all the rectangles under the curve and hey presto you have solved the integral.
@1972hattrick4 жыл бұрын
Simpsons rule is much better than your method
@lennywatchesstuff4 жыл бұрын
It's mostly used for higher dimensions because it is much faster. Imagine integrating an equation with multiple inputs, it will take forever to divide them into calculate the area for each inteval (you need (number of intevals)^(number of inputs) steps). For 10 variables, each one divide by say 10000, then you need (10000^10 steps). That's a lot of steps. Sure the error for monte carlos are higher than the midpoint method (O converges slower), but it is a very fast method that gives relatively decent accuracy.
@bishbash111gb4 жыл бұрын
This is the slowest of monte carlo integration techniques. You can use techniques such as importance sampling to increase the rate at which it converges
@PAA-ne3pc3 жыл бұрын
But how we are sure that the x_coord belong to the same point of y_coord that we are comparing e.g what if we compared a point on the function to another point under the function but with different x_coord
@natalie19979272 жыл бұрын
Hi! can you make a matlab video of how to use Monte Carlo method to calculate the volume of a cone inscribed in the unit cube(L=1)?
@FernandoRodriguez-ge2tg7 жыл бұрын
I know very basic java and I’m trying to tone out the python because it might confuse me. This video is fun
@michelebenedetti13353 жыл бұрын
Hi, I want to apply the Montecarlo method to solve a double integral over a polygonal domain, is it possible?
@SathanaST3 жыл бұрын
Thanks 🙏 you are really cool!
@rafaelrodrigues48674 жыл бұрын
Great video great explanation
@oneJL3 жыл бұрын
could you plz explain more in details that why you come up with the hight of 1/e? Thanks in advance
@pacersgo3 жыл бұрын
It is the max y value
@Marco-mt8kw5 жыл бұрын
Great video, it was helpful
@plastiqueman4 жыл бұрын
Thanks for the video, very helpful. I wrote the codes down exactly the same as you did but I'm getting an error "unsupported operand type(s) for *: 'NoneType' and 'float' "
@sirisaksirisak69814 жыл бұрын
In what situation MC doesn't work?How to reprove?
@pacersgo3 жыл бұрын
MC can be too slow for some applications. For example in radiotherapy, people try to calculate the distribution of the radiation dose to the patient body in real time. And until now it is still not possible with MC because of the long computational time.
@IK-dx6fr2 ай бұрын
Great video
@chrischoir35944 жыл бұрын
very nice, thanks
@henryadolfo3 жыл бұрын
Well done !
@sakibhasan78573 жыл бұрын
pretty cool man❤
@____kklw71483 жыл бұрын
very clear
@ncirisaif91624 жыл бұрын
thank you
@theirishpizzaguy66633 жыл бұрын
This might be a perfect explanation/tutorial.
@hsinghal12 жыл бұрын
ok
@staynjohnson42213 жыл бұрын
Unfortunately, there is no double-like button.
@tongxie7078 Жыл бұрын
This is the worst explanation I have seen on this stuff. Thank you so much!
@maxdefire4 жыл бұрын
Time solution obtain solution time time solution time obtain solution.
@michaelblankenau3129 Жыл бұрын
I just keep hearing the same words over and over again
@_tube73622 жыл бұрын
Dame good explanation, Can I get your email/Linkedin account?