I am trying to calculate the numerical integral of a 4D function, but NIntegrate
keeps saying that is not able to perform a good estimate.
My function comes from an exponential of four derivatives of something else so it is a "big" chunck (around 3 lines), but it is not oscillatory, it does not have divergences and the final value cannot be zero because it is always positive. It actually looks more or less like a 4D Gaussian.
The function is:
L[a_,c_,w_,u_]= Exp[
-(Y[1] - f[X[1], a, c, w, u])^2/(2*0.005^2) - (Y[2] - f[X[2], a, c, w, u])^2/(2*0.005^2)
-(Y[3] - f[X[3], a, c, w, u])^2/(2*0.005^2) - (Y[4] - f[X[4], a, c, w, u])^2/(2*0.005^2)
]
where:
X={0.266667, 0.5, 1, 1.16667}
Y={0.867, 0.596, 0.0689, -0.00554}
and f[q,a,c,w,u]
is given by:
f[q_,a_,c_,w_,u_]=(1/(c (c^2 + a^2 π^2) q)
3 a π Csch[a π q] (c Cos[
c q] (-1 - c^4 u - 5 a^4 π^4 u +
c^2 (10 a^2 π^2 u - w) + 3 a^2 π^2 w +
2 a^2 π^2 Csch[a π q]^2 (10 (c^2 - 5 a^2 π^2) u + 3 w -
60 a^2 π^2 u Csch[a π q]^2)) +
a π Coth[a π q] (1 + 5 c^4 u + a^4 π^4 u - a^2 π^2 w +
c^2 (-10 a^2 π^2 u + 3 w) +
6 a^2 π^2 Csch[a π q]^2 (-10 (c - a π) (c + a π) u - w +
20 a^2 π^2 u Csch[a π q]^2)) Sin[c q]))/1.653
In theory I am interested in the integral from -infinity to infinity of the four parameters a,c,w,u. But I know that most of the time the function is zero, so it will be enough to integrate {a, 0.5,0.7}, {c, 3.05, 3.25}, {w, 0.02, 0.2}, {u, -0.003,-0.0001}
.
I have tried with the automatic configurations for NIntegrate and it says:
NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more than 2000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration. NIntegrate obtained
6.0484948162078716`*^-9
and1.3350642633041837`*^-12
for the integral and error estimates.
Do you know a better NIntegrate
strategy for my problem? I was thinking of replacing my function by an approximate interpolating function, but I don't know if this is the best I can do. I have tried MonteCarlo methods but after increasing the Iterations until it finally says it converges, the results changes by 10% if you try the command again.
"SymbolicProcessing" -> 0
would prevent symbolic manipulation, but that is usually effective only when you know whatMethod
strategy/rule to use. -- 2D integrals are already numerically hard, and >2D are really hard. It may simply be hard. -- You could increaseMaxRecursion
. $\endgroup$X[[1]]
with double brackets and notX[1]
with single brackets? $\endgroup$