Download presentation
Presentation is loading. Please wait.
1
Monte Carlo integration
It is a numerical probabilistic algorithm a b I/(b-a) f Prabhas Chongstitvatana
2
Prabhas Chongstitvatana
MCint(f,n,a,b) sum = 0 For i = 1 to n do x = uniform(a,b) sum = sum + f(x) Return ( b-a) * (sum/n) I/(b-a) b-a Prabhas Chongstitvatana
3
Prabhas Chongstitvatana
Variance of the estimate is inverse proportion to n The expected error is proportion to A deterministic algorithm for integration will sample at regular interval. Prabhas Chongstitvatana
4
Prabhas Chongstitvatana
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
5
Prabhas Chongstitvatana
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
6
Probabilistic counting
A n-bit register can count up to 2n events (0..2n-1) init(c) ; reset tick(c) ; increment count(c) ; return count value Skip some value to count farther Prabhas Chongstitvatana
7
Prabhas Chongstitvatana
tick(c) flip a coin if head increment count(c) return value x 2 Expected value after call count() t time is exactly t. Prabhas Chongstitvatana
8
Prabhas Chongstitvatana
tick(c) flip a coin if head increment count(c) return value x 2 Expected value after call count() t time is exactly t. Count exponentially farther (8-bit count more than 5 x 1076 events) count(c) return 2c – 1 Prabhas Chongstitvatana
9
Prabhas Chongstitvatana
Estimate number of tick 2c+1 – 1 with probability p 2c – 1 with prob. (1- p) Expected value (2c+1 – 1 ) p + (2c – 1 ) ( 1 – p ) = 2c + 2c p – 1 p = 2-c will get the correct expected value of count(c) Prabhas Chongstitvatana
10
Prabhas Chongstitvatana
init(c) c = 0 tick(c) For i = 1 to c do if coinflip = head then return c = c + 1 count(c) Return 2c – 1 Prabhas Chongstitvatana
11
Prabhas Chongstitvatana
Variance of count after m ticks is m(m-1)/2. The standard deviation is 70%. This means it cannot distinguish between one million and two million but it can distinguish between one million and 100 million. Prabhas Chongstitvatana
12
Prabhas Chongstitvatana
Count logarithmic farther count(c) = when e is small e = 1/30 count up to > events in 8-bit register with less than 24% relative error with confidence 95%. What is probability that tick(c) increment ? Prabhas Chongstitvatana
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.