# NIntegrate complaining of not converging at a point outside the range

I am trying to evaluate the following numerical integral with mathematica but it is complaining of failing to converge around points outside the range.

k = 9.011
\[Gamma] = .49
NIntegrate[\[Eta]^2 Sqrt[\[Eta]^2 - \[Gamma]^2] BesselJ[0,
k \[Eta]]/((2 \[Eta]^2 - 1)^2 -
4 \[Eta]^2 Sqrt[(\[Eta]^2 - \[Gamma]^2) (\[Eta]^2 -
1)]), {\[Eta], 2, Infinity}]


NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in [Eta] near {[Eta]} = {0.490372}. NIntegrate obtained -0.00253366-0.0120694 I and 1.125809738960674*^-7 for the integral and error estimates.

And I appreciate if you have any explanation about the complex answer.

• The first error provides some clues: 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. – bill s Sep 28 '17 at 17:12
• I think the integral is divergent but I can't still understand the errors and imaginary part of the answer. – Mohammad Sep 28 '17 at 18:31
• NIntegrate is probably using complex methods internally. The numbers in such error messages are typically garbage so don't worry about it. I think it diverges but if you need to prove it diverges that may be a difficult task. – george2079 Sep 28 '17 at 20:12

Not so much an answer but to elaborate on the issue..using EvaluationMonitor we see it does quite a lot of evaluating outside the integration limits.

k = 9.011
\[Gamma] = .49
integrand = \[Eta]^2 Sqrt[\[Eta]^2 - \[Gamma]^2] BesselJ[0,
k \[Eta]]/((2 \[Eta]^2 - 1)^2 -
4 \[Eta]^2 Sqrt[(\[Eta]^2 - \[Gamma]^2) (\[Eta]^2 - 1)]);
{result, evals} =
Reap[NIntegrate[y = integrand, {\[Eta], 2, Infinity},
EvaluationMonitor :> Sow[{\[Eta], y}]]];
Show[{ListPlot[evals[]],
Plot[integrand + 1/2, {\[Eta], 0, 10}, PlotStyle -> Red,
PlotPoints -> 1000, PlotRange -> {-20, 20}]}] you can see it also stopped at 10. This has come up before (I cant find it though) but the speculation is that some internal change of variable has been made, and the change is not correctly reflected in the error message, or in what is passed to EvaluationMonitor

A manual change of variable fixes that issue (It still fails to converge as highly oscillatory however):

k = 9.011
\[Gamma] = .49
integrand = \[Eta]^2 Sqrt[\[Eta]^2 - \[Gamma]^2] BesselJ[0,
k \[Eta]]/((2 \[Eta]^2 - 1)^2 -
4 \[Eta]^2 Sqrt[(\[Eta]^2 - \[Gamma]^2) (\[Eta]^2 -
1)]) /. \[Eta] -> \[Eta] + 2 ;
{result, evals} =
Reap[NIntegrate[y = integrand, {\[Eta], 0, Infinity},
EvaluationMonitor :> Sow[{\[Eta], y}]]];
result
Show[{ListPlot[evals[], PlotRange -> {{0, 10}, {-5, 5}}],
Plot[integrand, {\[Eta], 0, 10}, PlotStyle -> Red,
PlotRange -> {-5, 5}]}]
` • I think the integral is divergent but I can't still understand the errors and imaginary part of the answer. – Mohammad Sep 28 '17 at 18:32