I'm having a huge problem with Monte Carlo integration. This simple example adequately shows the problem.
ParallelTable[
NIntegrate[
3 Sin[θ2] Sqrt[(E^w2/((1 - E^w2 Cos[θ2])^2 + E^(2 w2) Sin[θ2]^2))]
Sin[θ3] Sqrt[(E^w3/((1 - E^w3 Cos[θ3])^2 + E^(2 w3) Sin[θ3]^2))],
{w2, -W, W}, {θ2, 0, Pi}, {w3, -W, W}, {θ3, 0, Pi},
Method -> "QuasiMonteCarlo"] /
(NIntegrate[
Sin[θ2]Sqrt[(E^w2/((1 - E^w2 Cos[θ2])^2 + E^(2 w2) Sin[θ2]^2))],
{w2, -W, W}, {θ2, 0, Pi},
Method -> "QuasiMonteCarlo"])^2,
{W, 1, 10000, 100}]
This gives
{3.0014, 2.9491, 2.85273, 2.94142, 3.13837, 3.3748, 3.59702, 3.76732, 3.866,
3.88818, 3.83872, 3.72786, 3.56807, 3.37201, 3.15141, 2.91649, 2.67575, 2.43598,
2.20243, 1.97891, 1.76811, 1.5717, 1.39061, 1.22513, 1.07511, 0.940038, 0.819179,
0.711636, 0.616418, 0.532496, 0.458835, 0.394427, 0.338305, 0.28956, 0.247351,
0.2109, 0.179505, 0.152529, 0.129403, 0.109619, 0.0927273, 0.0783328, 0.0660878,
0.0556886, 0.046871, 0.0394056, 0.033094, 0.027765, 0.0232714, 0.0194869,
0.0163033, 0.0136281, 0.0113825, 0.00949942, 0.00792187, 0.00660148, 0.00549731,
0.00457473, 0.00380451, 0.00316199, 0.00262639, 0.00218025, 0.00180887, 0.00149994,
0.00124312, 0.00102975, 0.000852585, 0.000705567, 0.000583633, 0.000482557,
0.000398814, 0.000329467, 0.000272068, 0.000224581, 0.000185313, 0.000152854,
0.000126035, 0.000103886, 0.0000856005, 0.0000705103, 0.0000580618, 0.0000477963,
0.0000393339, 0.0000323603, 0.0000266154, .0000218844, 0.0000179894, 0.0000147838,
0.0000121462, 9.97676*10^-6, 8.19278*10^-6, 6.7262*10^-6, 5.52086*10^-6,
4.53049*10^-6, 3.71696*10^-6, 3.04885*10^-6, 2.5003*10^-6, 2.05002*10^-6,
1.6805*10^-6, 1.37731*10^-6}
The integral in the numerator is just the integral inside the denominator squared. So this expression is essentially computing $3\,x\,/\,x$. Monte Carlo integration should be calculating the numerator integral to have the same value as the denominator integral squared regardless of how large W is. Thus, you would expect the output to be a list of numbers near 3 if not exactly 3.
But as the results below show, as W
increases the Monte Carlo integration becomes worse and worse at estimating the numerator. It progressively underestimates the value of the numerator as W
becomes larger and larger. If anyone can help me successfully integrate these types of functions for large W
, I would greatly appreciate it.
What I describe here happens even when I use regular Monte Carlo integration and not just Quasi-Monte Carlo.
w2
is small). The Monte Carlo picks are probably missing this region. Hitting the region is presumably more difficult in the four-fold integral than in the two-fold integral. $\endgroup$u==Exp[w]
. For accurate Monte Carlo integration, I think you want to try to minimise the variance of the integrand. $\endgroup$AdaptiveQuasiMonteCarlo
Method
. This hopefully spends more of the evaluations near the peaks of the function. For more ideas the reference has a great guide to numerical integration with many good examples and also a big section how to tune MonteCarlo integration. $\endgroup$