1
$\begingroup$

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 ?

Thank you for your help in advance.

$\endgroup$
2
  • 1
    $\begingroup$ I certainly wouldn't. $\endgroup$
    – Feyre
    Jan 8, 2017 at 22:23
  • 2
    $\begingroup$ 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. $\endgroup$ Jan 8, 2017 at 22:23

1 Answer 1

3
$\begingroup$

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} *)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.