1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – bill s Sep 28 '17 at 17:12
  • $\begingroup$ I think the integral is divergent but I can't still understand the errors and imaginary part of the answer. $\endgroup$ – Mohammad Sep 28 '17 at 18:31
  • $\begingroup$ 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. $\endgroup$ – george2079 Sep 28 '17 at 20:12
2
$\begingroup$

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[[1]]], 
  Plot[integrand + 1/2, {\[Eta], 0, 10}, PlotStyle -> Red, 
   PlotPoints -> 1000, PlotRange -> {-20, 20}]}]

enter image description here

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[[1]], PlotRange -> {{0, 10}, {-5, 5}}], 
  Plot[integrand, {\[Eta], 0, 10}, PlotStyle -> Red, 
   PlotRange -> {-5, 5}]}]

enter image description here

$\endgroup$
  • $\begingroup$ I think the integral is divergent but I can't still understand the errors and imaginary part of the answer. $\endgroup$ – Mohammad Sep 28 '17 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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