I have been getting some ideas by reading other related questions in the forum, but the integral I have to do is not converging in many cases. The integrand is of the form:
1/(a (qx^2+qy^2) + c qz^2)^2 * 1/( b(qx^2+qy^2+qz^2) + w) *
Abs[U[qx,qy,qz](qx Z1 + qx Z2 + qx Z3)]^2
and it's a volume integral around {qx,qy,qz}={0,0,0}
. So one has a singularity in {0,0,0}
coming from the first term, and a singularity given by the equation b(qx^2+qy^2+qz^2) + w == 0
, because b < 0
and w >0
. U
is constructed using Interpolation. a>0, c>0
, and Z1, Z2, Z3
are parameters.
Problem(s):
(i) I get "Numerical integration converging too slowly; suspect one of the
following: singularity, value of the integration is 0, highly
oscillatory integrand, or WorkingPrecision too small". There is a singularity, but I get the message even after using Exclusions. U
varies smoothly (although there is a jump discontinuity in {0,0,0}
); there are no oscillations. I think the result should be around 10^(-6) or larger; it's not 0.
(ii) I get that the number of errors is bigger than MaxErrorIncreases, which I set to 10000. And then the integration just never finishes.
Exclusions: Exclusions -> {{0, 0, 0},
b (qx^2 + qy^2 + qz^2) + w == 0}
doesn't seem to help. And actually it makes the integral take longer.
MinRecursion: does help. Setting MinRecursion->4
seems to get a converged result.
PrecisionGoal and AccuracyGoal: if I set them to 2, then the integral finishes after 300 seconds with MinRecursion->2
(or 2000 seconds with MinRecursion->10
). However, I get more than 10000 MaxErrorIncreases
if I set PrecisionGoal
and ACcuracyGoal
to 4!
WorkingPrecision: I am setting it to 20...although the parameters in the expression have less amount of decimals. I guess this is equivalent to setting WorkingPrecision to the maximum number of decimals in the parameters.
U
is created using Interpolation, with a 6x6x6 grid around {0,0,0}
. If I use a 3x3x3 grid, then I can set PrecisionGoal
and AccuracyGoal
to 4 (as opposed to only 2 here).
So, what I have is:
Nintegrate[1/(a (qx^2+qy^2) + c qz^2) * 1/( b(qx^2+qy^2+qz^2) + w) *
Abs[U[qx,qy,qz](qx Z1 + qx Z2 + qx Z3)]^2, {qz, -qo, qo}, {qy, -qo, qo}, {qx,-qo,qo}, WorkingPrecision -> 20,
MinRecursion -> 4, MaxRecursion -> 100, PrecisionGoal -> 4, AccuracyGoal -> 4,
Exclusions -> {{0, 0, 0}, b (qx^2 + qy^2 + qz^2) + w == 0},
Method -> { "SymbolicPreprocessing", "OscillatorySelection" -> False ,
Method -> {"GlobalAdaptive", "MaxErrorIncreases" -> 10000}}]
a=5, c=4.98, b=-0.23, Z1=Z2=3, Z3=-3.1, qo=0.1, w=0.00368
. I can include the values that are used to construct the interpolation function U
, and the definition of U
, but that involves 800 lines.
Any ideas? I was thinking about using the trapezoidal method. Or maybe use Boole to do the integral at both sides of the b(qx^2+qy^2+qz^2) + w == 0
singularity. I am now running calculations using variations of PrecisionGoal
and MinRecursion
, but I think there wasn't a problem with the calculation around (0,0,0}. The problem is the b(qx^2+qy^2+qz^2) + w == 0
.
Edit: I'm not sure if I should include this as a comment or as an edit here, but after I started to doubt Mathematica (considering there was some post that asked about how can we trust the results of NIntegrate), I realized that the singularity converges with a PrincipalValue
. So I think my question reduces to this question:
How to do multi-dimensional principal value integration?. It seems I have to switch to spherical coordinates, which I wanted to avoid.