I'm trying to use NIntegrate to calculate this complicated multiple integration, which has absolute value in the Exp and Cos functions. $$ \int_{-\infty}^{\infty} dx_1 \int_{-\infty}^{\infty} dx_2 \int_{-\infty}^{\infty} dy_1 \int_{-\infty}^{\infty} dy_2 \quad \frac{1}{r_1 r_2} \exp(-|x_1-x_2|-2|y_1-y_2|) \cos(3 |x_1-x_2|) $$ where $r_1=\sqrt{x_1^2+y_1^2}$ and $r_2=\sqrt{x_2^2+y_2^2}$
I've tried,
eqn = (Exp[-RealAbs[x1 - x2] - 2 RealAbs[y1 - y2]] Cos[3 RealAbs[x1 - x2]])/(Sqrt[x1^2 + y1^2] Sqrt[x2^2 + y2^2])
NIntegrate[eqn, {x1, -Infinity, Infinity}, {x2, -Infinity,
Infinity}, {y1, -Infinity, Infinity}, {y2, -Infinity, Infinity} ]
but NIntegrate can't converge and returns with result of 43.04 which is apparently wrong for the large accompanying error estimate 106.
NIntegrate: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 36 recursive bisections in x2 near {x1,x2,y1,y2} = {0.844124,0.5,0.844124,0.844124}. NIntegrate obtained 43.04088365833965` and 106.01214916269602` for the integral and error estimates.
Other methods, such as QuasiMonteCarlo, also can't work and returns with wrong value.
NIntegrate[eqn, {x1, -Infinity, Infinity}, {x2, -Infinity,
Infinity}, {y1, -Infinity, Infinity}, {y2, -Infinity, Infinity},
Method -> "QuasiMonteCarlo"]
NIntegrate:The integral failed to converge after 50000 integrand evaluations. NIntegrate obtained 0.5832445898563868` and 4.830661305937795` for the integral and error estimates.
I've been also thinking about possible ways to simplify this integration analytically, which seems impossible due to the absolute symbol and r terms in the denominator.
I would appreciate a lot if any advice or thought is given on either numerical or analytical side.
MaxRecursion -> 40, PrecisionGoal -> 12
you'll different values also. It is not good idea to integrate with something that has absolute value. This applies to both numerical or analytical. Try to rewrite the integrals without absolute in them and see if that works better. $\endgroup$