![]() ![]() The method is based on the mathematical formula for calculating the area of a unit circle (i.e. There are plenty of good articles on the Internet for more detailed information. ![]() I'm going to briefly explain the underlying math principle. ![]() Let's keep this fraction in mind as we're going to need it in the next step. This is due to the law of large numbers and the fact that we reach ever better distribution. Interestingly, the fraction of raindrops inside the quarter circle over the total number of raindrops will constantly change as we generate more raindrops. This is what it looks with 1000 raindrops: Logically, a lot more raindrops will fall inside the quarter circle than outside of it. blue dots), and some will lie outside of it (i.e. Some raindrops will lie inside the quarter circle (i.e. The raindrops are going to be evenly distributed on the unit square. Now, let's imagine it is raining on this unit square with perfect randomness. Inside this unit square, draw a quarter circle with a radius of 1. Take a sheet of paper and draw a unit square (whose sides have length 1) on it. Let me explain the idea behind the Monte Carlo Simulation with an analogy to rain. In order to refresh some old memories, I decided to implement an interactive simulation in React and TypeScript. Still, seeing the number getting more and more precise continues to amaze me. Calculating an infinite number like pi doesn't sound like fun for most people. The simple – yet genius – idea behind this concept just blew my mind. When I was in university, I first learned about the Monte Carlo Simulation as way to calculate π \pi π ![]()
0 Comments
Leave a Reply. |