NIntegrate w/ MaxErrorIncreases in Mathematica 8

  • Context: Mathematica 
  • Thread starter Thread starter muppet
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around the use of the MaxErrorIncreases option in the NIntegrate function of Mathematica 8 for numerically evaluating a specific integral involving the Bessel function J_0. Participants explore issues related to error messages encountered during integration, particularly in the context of oscillatory integrals and the behavior of the integral as a function of the parameter b.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes an integral that generates an NIntegrate::eincr error message, indicating that the global error has increased significantly, despite attempts to adjust the MaxErrorIncreases option.
  • Another participant notes that the MaxErrorIncreases option works when using the ExtrapolatingOscillatory method combined with GlobalAdaptive, suggesting a potential workaround.
  • A participant inquires about the specific value of b that triggers the error, indicating that the issue may be dependent on this parameter.
  • Concerns are raised about the convergence of the integral for values of b between 0 and 1, with one participant suggesting that the oscillatory nature of the function complicates numerical convergence.
  • Another participant argues that the function should vanish as q approaches zero, providing an analytic perspective that suggests convergence should not be an issue, although computational difficulties remain.
  • It is mentioned that the algorithms for evaluating oscillatory integrals may converge more quickly at higher frequencies, which could explain the slow convergence observed for small values of b.

Areas of Agreement / Disagreement

Participants express differing views on the convergence behavior of the integral, particularly regarding its dependence on the parameter b. There is no consensus on whether the issues are due to a bug in Mathematica or inherent difficulties with the integral itself.

Contextual Notes

Participants highlight limitations related to the numerical evaluation of oscillatory integrals, particularly the dependence on the choice of method and parameters like MaxErrorIncreases. The discussion also reflects uncertainty about the analytic behavior of the integral at small values of b.

muppet
Messages
602
Reaction score
0
MaxErrorIncreases option for NIntegrate in Mathematica 8

Hi all,

I'm trying to do the following integral numerically in Mathematica 8 (defining a function of the parameter b):
\int^{\infty}_0 dq q J_0(b q) \left(\left(1-q^2\right)^{3/2} \theta \left(1-q^2\right) \left(\frac{3 q^2+2}{15 q^4}-\frac{\frac{1}{q^2}+\sqrt{1-\frac{1}{q^2}} \tanh ^{-1}\left(\sqrt{1-\frac{1}{q^2}}\right)-1}{\left(1-\frac{1}{q^2}\right)^2 q^2}\right)-\frac{2}{15 q^4}\right)

I'm getting the NIntegrate::eincr error message, to the effect that the global error has increased more than 400 times when it's expected to go down with repeated recursive bisections of the integration region. It says that I should be able to work around this by using the method option Method->{GlobalAdaptive,MaxErrorIncreases->10000} to increase the patience of Mathematica in waiting for the oscillatory integral to converge. However, on using this option I'm still getting the same error message, still quoting the default value for MaxErrorIncreases of 400. I'm defining a function

maxerrinc[b_]:=NIntegrate[i[q,b],{q,0,Infinity}, Method->{"GlobalAdaptive",MaxErrorIncreases->10000}, MaxRecursion->100]

where i[q,b] is just the integrand above, and I get the standard error message when I try and plot it. I tried to test my syntax on the simple example given in the mathematica documentation, but it turns out that it evaluates fine without ever generating that error message :rolleyes:

Is this a bug, or am I doing something dumb?
Thanks in advance.
 
Last edited:
Physics news on Phys.org
PostScript: Bizarrely, this option actually works using GlobalAdaptive as a submethod of the "ExtrapolatingOscillatory" method:
extosc[b_]:=NIntegrate[i[q,b],{q,0,Infinity},Method->{"ExtrapolatingOscillatory",Method->{"GlobalAdaptive",MaxErrorIncreases->100000}},MaxRecursion->50]
seems to be working!
 
I put in this function into mathematica. What value of "b" are you using that this error occurs?

Code:
FX[b_] := NIntegrate[q BesselJ[0, b q] ((1 - q^2)^(3/2) HeavisideTheta[1 - q^2] ((3 q^2 + 2)/(15 q^4) - (1/q^2 + Sqrt[1 - 1/q^2] ArcTanh[Sqrt[1 - 1/q^2]] - 1)/((1 - 1/q^2)^2 q^2)) - 2/(15 q^4)), {q, 0, \[Infinity]}]
 
The problems of large global error seem to occur for b between 0 and 1; in the case of the extrapolating oscillatory method where I can actually change the 'MaxErrorIncreases' option successfully, I'm still getting the error message after increasing this variable from 400 to 500 000 (shortly before my computer runs out of memory). I've no idea why, because I've good reason to think the answer is neither zero nor infinite...
 
For a high "b" this is a VERY highly oscillatory function. I'm not sure you can trust its convergence numerically. Basically with that theta function, the first integral is only from 0 to 1, which mathematica is telling me doesn't converge algebraically.

If you expand it near "q" is zero, you get 1/q^3 behavior, which is divergent in the integral at q = 0.
 
Actually, I think for small q it should vanish like q. I checked in mathematica that the limit as q->0 is 0; the term in brackets (i.e. everything apart from q*J_0(bq)) is a special case of a more general function depending on an additional variable n, which here is set to three, and I have a finite analytic result for the q->0 limit for general n. (It doesn't work if you try and do the integral from 0 to 1 separately, because it depends on a cancellation with the term you integrate over the full region.) This function also behaves for large q like 1/q^4, so I really don't think convergence should be a problem from an analytic point of view, just from a computational one.

Like I say, the problem is really occurring at small values of b, between zero and one. The kinds of algorithms used to evaluate oscillatory integrals over infinite regions I think typically converge faster at higher frequencies, which explains why I'd expect slow convergence at small values of b. The trouble is that it seems to be converging too[\i] slowly to be practicable, and I can't find a way of speeding it up; it was starting from scratch and trying to build up from the default settings that I encountered the problem of not being able to adjust "MaxErrorIncreases" for the default Global Adaptive method.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
10
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
5K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K