B prev next
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

<< MC INTEGRATION >>

Algoritm:
1. Enclose the function in a box area y_max.

2. Uniformly populate the box with N random points:
   Generate two random numbers
   R1, R2, a random point in the box is then
   x = a + (b-a)*R1
   y = y_max*R2

3. Count the number of points M
   that lie below the curve f(x).

4. The integral is then estimated from:
   I/A = M/N and so
   I = (M/N)*A and so
   I = (b-a)*y_max M/N