Monte Carlo Simulation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi and welcome to a video about Monte Carlo simulations, a type of simulation that i really enjoy because it's a super simple concept and it still allows to solve incredibly complex problems. So after watching this video you will know exactly what Monte Carlo simulations are and what types of problems you can solve with them. So what are Monte Carlo simulations? Well the name Monte Carlo actually refers to the city in Monaco which is known for its casinos and gambling, and in the context of simulations "Monte Carlo" is basically used as a synonym for randomness, like the randomness in gambling. So, Monte Carlo simulations are simulations evolving randomly, and this might seem counterintuitive at first because how can something useful come out of a randomly evolving simulation? but we will see why randomness can be actually very useful in a simulation in just a moment. So let's take a look at the first example. In the simulation we have a sort of marble dropping device that moves around randomly above this rectangular table and drops marbles, and on the table there are two bowls one with a square cross section and one with a circular cross section, and each of these bowls is placed on some sort of scale which displays how many marbles are in each bowl at this time, and if we let the simulation evolve for a while and then divide the number of marbles in the circular bowl by the number of marbles in the square bowl the result happens to be roughly pi. Without any advanced math knowledge, simply by randomly dropping marbles into two bowls, we can estimate pi. Okay so let's unpack what happened in this simple example of a Monte Carlo simulation. When we drop a marble in a uniformly random location then the probability for this marble to end up in one of the bowls is proportional to the bowls cross-section area, and if we repeat this process over and over again then also the number of marbles ending up in this bowl will be proportional to the bowl's cross-section area. The area of the square bowl in this example is its edge length a squared and the area of the circular bowl is pi times a squared, and that's how we get pi as the fraction of the two areas and consequently as the fraction of marbles in each bowl. So in this example of a monte carlo simulation, we essentially determine an area by taking random samples. With each random sample we probe whether this specific location is inside or outside of some area, and by taking enough samples we get a good idea of how big an area is. This idea of obtaining random samples is probably quite familiar to you if you think about how real world studies are designed. Let's say we wanted to find out the average height of all people worldwide. Then, in principle we would need to measure the height of each person worldwide, and then take the average to get an accurate result, but of course we can't go out and measure the height of billions of people. So what can we do? Well we can measure the height of some smaller group of people, and hope that their average height is a good estimate for the average height of all people worldwide, but there are two things that we need to consider. Firstly the selection of the group of people needs to be unbiased. We can't just measure the height of the next five people we meet as we might live in an area with especially tall or short people. A better way to get an unbiased sample group would be to randomly select people worldwide. Randomness helps us to make an unbiased selection. Secondly, the group of measured people must not be too small. If we only measure the height of let's say five people we might have just coincidentally picked five taller or shorter people, and we can be more and more confident about the average height the more people we measure. In probability theory this is called the "law of large numbers" which essentially states that an average tends to come closer to its expected value the more samples we have, and the exact same is also true for Monte Carlo simulations. The core idea of a Monte Carlo simulation is that we can get an unbiased, representative group of samples from some large ocean of possibilities if we allow the simulation to evolve randomly. In the marble dropping example, in principle we would need to test for every possible location whether a marble ends up inside or outside the bowl to determine the bowl's cross-section area precisely, just like we in principle would need to measure the height of each person worldwide to determine the average height accurately. Instead, we can rely on randomly selected samples, and according to the law of large numbers we can be more and more confident about the result the more samples we take. We can see this if we plot the fraction of marbles in both bowls over time. Initially, the value is fluctuating heavily, but with more and more samples generated by the randomly evolving simulation, the fluctuations become smaller and smaller, and we can see that the fraction approaches the expected value pi Now I hope that using a Monte Carlo simulation to determine pi was an illustrative example, but it's certainly not really relevant, but actually this animation of dropping marbles has a second example of a monte carlo simulation somewhat hidden in it. So let's take a look at this hidden more relevant example of a Monte Carlo simulation in the last part of this video. Rendering such animations or the simpler example scene is all about simulating the flow of light, and to get an accurate image you need to find out how much light hits different areas of the scene. This is not an easy task if you consider that diffuse surfaces can scatter light in virtually any direction. So let's say we want to find out how much light hits this marked area. Then, in principle we would need to evaluate all possible light paths to find out which fraction of them ends up in the marked area. Now clearly it's impossible to follow all the possible light paths. So what can we do if we can't follow all possible paths? Well I hope that after watching the video to this point, the answer is quite obvious. If we can't simulate all possible light paths then the best we can do is to simulate a representative group of sample paths, and what is a good way to get an unbiased representative group of samples? We can employ randomness! So whenever we hit a diffuse surface we simply pick, randomly, one of the infinitely many directions in which the light could be scattered. One randomly simulated light path on its own is not valuable, but if we generate many sample paths then we get a good idea of the illumination of the scene. We will see areas that are hit by many of the randomly generated light rays (brighter areas) and we'll see other areas that are hit only by few of the randomly generated rays (darker areas). Actually if you think about it, counting the number of randomly generated light rays hitting some area is really not that different from counting the number of randomly dropped marbles hitting some bowl, and in this marble dropping attempt to determine pi we saw that the result gets more accurate the more samples we take, and the same is also true for Monte Carlo path tracing. These four images show the same scene rendered with a different number of randomly simulated light paths. We can clearly see that with more sampled paths the result becomes more accurate, leading to a less noisy image. Okay so let's wrap this up. A Monte Carlo simulation is a randomly evolving simulation, and in this video we have looked at two examples how such a randomly evolving simulation can be useful. We have determined pi by randomly dropping marbles into bowls, and we have simulated the flow of light by generating random light paths. Both these examples and many other examples where Monte Carlo simulations are useful, they have one thing in common. They involve an unfeasibly large number of possibilities, and instead of trying to go through all these possibilities, with monte carlo simulations we deliberately only explore a random subset of them, and according to the law of large numbers we can still get away with these random samples if we only gather enough of them. Okay so that's it for this video. I hope you found it useful. If you did, please leave a like and maybe subscribe and i hope to see you in the next video! Bye. you
Info
Channel: MarbleScience
Views: 710,709
Rating: 4.9287271 out of 5
Keywords: monte carlo simulation, monte carlo method, monte carlo sampling, path tracing, random sampling, monte carlo, determine pi, unbiased sampling, monte carlo algorithm, monte carlo simulation example, monte carlo model, monte carlo simulation pi
Id: 7ESK5SaP-bc
Channel Id: undefined
Length: 10min 5sec (605 seconds)
Published: Tue Sep 08 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.