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 >>

Example: Computing area under the curve: y = 10 sin(x) between 0 and pi.

Exact solution is 20.0.


      N           Area         Error 
 -------------   --------    --------- 
            10   18.84956    1.1504420 
           100   20.42035    0.4203548 
         1,000   19.94912    0.0508842 
        10,000   20.08106    0.0810623 
       100,000   19.94000    0.0599956 
     1,000,000   20.00874    0.0087432 
    10,000,000   19.99852    0.0014839 
   100,000,000   20.00074    0.0007362 
 1,000,000,000   20.00051    0.0005044 
We have to perform
many experiments, with different seeds, to see results more clearly.


The computer implementations of the algoritm: mc-int.f90 | mc-int.c | mc-int.cpp | mc-int.exe