October 2019
Intermediate to advanced
340 pages
8h 39m
English
In Step 5, you will see the following plot, where dots are randomly placed inside the circle:

The Monte Carlo method is so powerful thanks to the Law of Large Numbers (LLN). Under LLN, the average performance of a large number of repeated events or actions will eventually converge to the expected value. In our case, with a large number of random points, 4 * (n_point_circle / n_point) will eventually converge to the true value of π.
Finally, in Step 8, we print the estimated value of pi and get the following result:
Estimated value of pi is: 3.156
The value of π approximated using the Monte Carlo method is quite close to its ...
Read now
Unlock full access