|
Interactive animation |
Monte-Carlo simulation
The expression "Monte-Carlo simulation" refers to a large number of techniques that have the same approach to solving complex problems :
This kind of situation is very common in all fields of mathematics, physics, chemistry, biology, economy, finance, sociology etc...The problems then encountered involve many variables, functions or differential equations.
It turns out that it is sometimes possible to solve such a problem numerically by introducing a random sampling scheme of the domain of the variables.
A method resorting to such an approach will be generically called a "Monte-Carlo simulation".
We here address one of the simplest applications of Monte-Carlo simulation.
How do we calculate the integral between a and b of the function represented in the illustration below ?
If no primitive function of f(x) is known, the integral cannot be calculated analytically. But if the function f(x) can be easily calculated at any point of the integration region, we can obtain a good approximation of the integral by resorting to numerical methods.
There are many such methods. The simplest one (and also the least effective !) is to divide up the range of x into a series of N adjacent rectangles (see lower image of the above illustration). The height of each rectangle is adjusted to the value of f(x) for x taken as the mid-point of the base of the rectangle. The (algebraic) sum of the areas of the rectangles is taken as an approximation of the (algebraic) area under the curve representing f(x), that is, its integral I :

If f(x) is well-behaved, and if the rectangles are narrow enough, then the calculated area will be a close approximation of the value of the integral.
-----
Note that this approximation of the integral is, within a geometric normalization factor, the sum of the values of f(x) taken at evenly spaced points in the integration region.
Now what if we try to use this technique for functions of more than just one variable ? We then run into two new difficulties :
Now comes an idea that is both simple and effective.
We noted that an integral is just the sum of the values of the function taken at evenly spaced points of the integration region. Now replace "evenly" by "randomly uniformly distributed". You have now your first Monte-Carlo method, so simple that it is often affectionately called the "crude" or "brute force" Monte-Carlo integration method.
So, in its simplest version, a Monte-Carlo calculation of the integral :

would go as follows :
|
|
Crude as it is, the simple Monte-Carlo integration method makes the two aforementioned problems less critical :
What is the price to pay for these advantages ?
Because of the random nature of the sampling of f(x), the number obtained at the end of a MC run is the realization of a random variable. In other words, if you run several MC calculations of a given integral, you'll never get twice the same value. These values follow a probability distribution with a definite variance. So whereas a deterministic integration method provides an approximation of the true value of an integral, the MC integration method provide an estimate of this value. The difference, although subtle, is important : the error of an approximation can often be bounded upwards, whereas there is usually no upper limit to the error of an estimation. But by making the number of random points large enough, the probability that this error exceeds a given value e can be made arbitrarily small (this is just a consequence of the Weak Law of Large Numbers). Of course, a consequence is that Monte-Carlo simulations runs are always very long.
We illustrate here the concept of Monte-Carlo integration on two problems.
|
Interactive animation |
____________________________________________________________
Related readings