INTERACTIVE ANIMATION : MONTE-CARLO INTEGRATION

This animation illustrates the concept of integration by Monte-Carlo simulation.

 The "Book of Animations" on your computer

# Default animation

The animation opens on a yellow scene with four black discs. You may move the discs about with your mouse. The question is : "What is the area of the black region ?".

The function to be integrated is "1", and the difficulty of the problem lies in the complicated shape of the boundary of the region of integration (black region).

• When the fours discs do not overlap, the area of the region is one half that of the yellow scene.
• When the discs overlap, the solution is at best very complicated, and even this elementary simulation provides a useful practical way of estimating this area.

Click on "Go", and observe the progressive build-up of the solution. Notice that the convergence is very slow : even after 100,000 iterations, the third decimal place is still unstable.

We keep the last 30 drawn points visible to give a feel for the fact that the points are drawn from a bidimensional uniform distribution. But updating of the estimated area is done after every new drawn point. Click on"Pause" and then on "Next" to see the update one point at a time.

# Calculating π

Click on "Reset".

We now present two simulations that allow estimating the value of π.

## Disc

Click on "Disc". A single black disc fills out the scene. Assuming that the scene is a square of side "1", the area of the disc is equal to the proportion of points that fall inside the disc. Write down the formula that gives the estimation of π as a function of this proportion.

## Buffon's needle

Reset and click on "Buffon".

A needle of length l is dropped on a board of width d. What is the probability for the needle to cross one of the edges of the board ? The answer involves π. From this answer, a Monte-Carlo estimation of π can be derived.

In this animation :

• The board is the green rectangle.
• The needle always has the same horizontal position (as this position has no impact on the result).
• The vertical position of the needle is drawn from a uniform distribution across the width of the board.
• The orientation of the needle is drawn from a uniform distribution in [0, π].

Note again that the convergence is very slow.

We keep the last 30 drawn points visible to give a feel for the fact that the points are drawn from a bidimensional uniform distribution. But updating of the estimated area is done after every new drawn point. Click on"Pause" and then on "Next" to see the update one point at a time.