Hi i have a problem concerning a numerical integration in mathematica. Here is my test function
Table[NIntegrate[
Boole[Sqrt[1 - cosk^2]*Sqrt[1 - cosk2^2] > Abs[a - cosk*cosk2]]/
Sqrt[(1 - cosk^2)*(1 - cosk2^2) - (a - cosk*cosk2)^2],
{cosk, -1,1}, {cosk2, -1, 1}, Method -> "GlobalAdaptive"], {a, -.9, .9, .1}]
The integration yields complex values although due to the boolean function in the integrand the argument in the sqrt should be always positive and hence only result in real values. Is it possible to first evaluate the boole function and only if it is true then start to numerically integrate?
If i calculate the same integral using a monte carlo integration strategy
Table[NIntegrate[
Boole[Sqrt[1 - cosk^2]*Sqrt[1 - cosk2^2] > Abs[a - cosk*cosk2]]/
Sqrt[(1 - cosk^2)*(1 - cosk2^2) - (a - cosk*cosk2)^2], {cosk, -1,
1}, {cosk2, -1, 1}, Method -> {"MonteCarlo", "MaxPoints" -> 10^8,
"SymbolicProcessing" -> None}], {a, -.9, .9, .1}]
how can I find out if it sums up a lot of zeroes due to the boolean function? I think the evaluation can save a lot of computation time if it first evaluates the boolean function for each sample point of the monte carlo grid. If i replace "MonteCarlo" by "AdaptiveMonteCarlo" the result goes totally wrong.