# checking the validity of integration solution given by mathematica [closed]

I have a question about the validity of the evaluation of the following integral. Here is the code with the errors and the solution

intExp = -((I E^(-\[Pi] r0^2 -32/5 I \[Pi] r0^4 s - \[Pi] r0^2 (-1 +
Hypergeometric2F1[-(1/2), 16, 1/2, -4 I \[Pi] s])) r0 (-1 + 1/(1 - 2 I \[Pi] s)))/s)

NIntegrate[intExp, {s, -Infinity, Infinity}, {r0, 0, Infinity}]

NIntegrate::slwcon: 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
18 recursive bisections in r0 near {s,r0} = {0.0249979,3.22008*10^-6}.

NIntegrate obtained 0.0998733 +3.46945*10^-18 I and 0.0000859904 for the integral
and error estimates.

(* 0.0998733 *)


The question is if I can consider this solution asa valid one even if there is an error ?

• I certainly wouldn't. – Feyre Jan 8 '17 at 22:23
• Given that your integrand is oscillatory, we can try another integration rule, namely NIntegrate[func, {s, -Infinity, Infinity}, {r0, 0, Infinity}, Method -> "LevinRule"]. This gives a much smaller error estimate, adding confidence to the answer. – Marius Ladegård Meyer Jan 8 '17 at 22:23

This kind of questions have been discussed before on this site. See for example this answer of "NIntegrate fails to converge under almost any PrecisionGoal, MinRecursion etc. How can I trust the result?".

In this case using higher values for the MinRecursion and MaxRecursion with both MachinePrecsion and high precision give convergent results without error messages.

AbsoluteTiming[
NIntegrate[intExp, {s, -Infinity, Infinity}, {r0, 0, Infinity},
Method -> "GlobalAdaptive", MinRecursion -> 6, MaxRecursion -> 50,
PrecisionGoal -> 6]
]

(* {9.34598, 0.0998716} *)

AbsoluteTiming[
NIntegrate[intExp, {s, -Infinity, Infinity}, {r0, 0, Infinity},
Method -> {"GlobalAdaptive", "SymbolicProcessing" -> 0},
MinRecursion -> 6, MaxRecursion -> 50, WorkingPrecision -> 40,
PrecisionGoal -> 6]
]

(* {59.7448, 0.09987163840809977400543790885232248125690} *)