Understanding the central limit theorem
The Monte Carlo method is essentially a numerical method for calculating the expected value of random variables; that is, an expected value that cannot be easily obtained through direct calculation. To obtain this result, the Monte Carlo method is based on two fundamental theorems of statistics: the law of large numbers and the central limit theorem.
Law of large numbers
This theorem states the following: considering a very large number of variables, , the integral that defines the average value is approximate to the estimate of the expected value. Let's try to give an example so that you understand this. We flip a coin 10 times, 100 times, and 1,000 times and check how many times we get heads. We can put the results we obtained into a table, as follows:

Figure 4.4 – Table showing the results for coin toss
Analyzing the last column of the previous table, we can see that the value of the frequency...