Monte Carlo method for solving integrals

675 Views Asked by At

My professor gives us an intro to how to evaluate integration using Monte Carlo method.
But I tried to search about it and never find the algorithm he used.

Any help how can I find an explanation of this approach enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I created a script that approximated an integral using the Monte Carlo method for a first year university MatLab project. The concept is quite simple when considered graphically.

Imagine that there is a graph $y=f(x)$, within the domain $[a,b]$. Generate $N$ random points and check if these points fall between $y=f(x)$ and the $x$-axis.

The approximation is achieved by dividing the number of points between the curve and the $x$-axis ($K$) by the total number of points generated ($N$).

This ratio is then multiplied be the total 'area' that the random points have been allowed to fall in. That is, the area of the rectangle with vertices listed clockwise from the top left, $(a,f_{max})$, $(b,f_{max})$, $(b,0)$ and $(a,0)$.

Therefore the approximation is given by $\int^b_af(x)\ \mathrm{d}x\approx\frac{K}{N}\times(b-a)\times f_{max}$.

Hope this is slightly clearer!