21 Jun 2017

# Monte Carlo Integration

Monte Carlo integration is an extremely powerful technique for integrating multivariate functions. In two dimensions, let f(x,y) be a function deﬁned on a square [x1,x2]×[y1,y2]. In Monte Carlo integration, one draws N pairs

(x(1),y(1)),(x(2),y(2)),…,(x(N),y(N)),

At random where the x(i)’s are uniformly distributed in [x1,x2] and the y(i)’s are uniformly distributed in [y1,y2], and computes the approximation

As N increases, one expects the approximation error to decrease.

One interesting application of Monte Carlo integration is in computing the areas of shapes. Let Ω be a subset of a square [x1,x2]×[y1,y2].

For Lemniscate:

• I have calculated the error for N ranging from 500 to 10,000 with an increment of 1.The error obtained was maximum for N= 500 and as can be seen from the image after N = 8000 the error remained almost constant.
• For the points in the region x1 = -1.5, x2 = 1.5 & y1 = -0.6, y2 = 0.6.The region of interest is the points at which the equation of Lemniscate is satisfied.
• Count of such points is calculated which is M and is used in to calculate the area of Lemniscate region.

For Mandelbrot: Here there is very high variation in the error as can be seen from the image below

• To find the area of the Mandelbrot what is done is

The whole region is divided into small parts and that no. of parts is N and then each point is checked with the equation and if the equation is satisfied than the count value i.e. M is incremented by 1.

• Than using the formula:

An approximate area of Mandelbrot for the given region can be calculated.

• For a range of values of N. The plot of Error vs N is plotted.