Monte Carlo integration It is a numerical probabilistic algorithm
Download
Report
Transcript Monte Carlo integration It is a numerical probabilistic algorithm
Monte Carlo integration
It is a numerical probabilistic algorithm
b
I f ( x)dx
a
f
I/(b-a)
a
Prabhas Chongstitvatana
b
1
MCint(f,n,a,b)
sum = 0
I/(b-a)
For i = 1 to n do
x = uniform(a,b)
b-a
sum = sum + f(x)
Return ( b-a) * (sum/n)
Prabhas Chongstitvatana
2
Variance of the estimate is inverse
proportion to n
The expected error is proportion to
1/ n
A deterministic algorithm for integration
will sample at regular interval.
Prabhas Chongstitvatana
3
DETint(f,n,a,b)
sum = 0
delta = (b-a)/n
x = a + delta/2
For I = 1 to n do
sum = sum + f(x)
x = x + delta
Return sum * delta
Prabhas Chongstitvatana
4
Advantage of MCint when doing multiple
integral in high dimension. As the sample point
increases exponentially with the dimension.
Example 100, 100x100, 100x100x100. MCint is
faster than a deterministic algorithm for
dimension >= 4.
Prabhas Chongstitvatana
5