Mathematica 8: indeterminate result of NIntegrate

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

Discussion Overview

The discussion revolves around the challenges of evaluating a family of complex integrals using Mathematica's NIntegrate function, particularly focusing on issues related to indeterminate results and the effects of working precision on the integration process.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes a function defined using NIntegrate that leads to an error message indicating that the integrand evaluates to Overflow, Indeterminate, or Infinity for all sampling points.
  • Another participant suggests trying an AdaptiveQuasiMonteCarlo method with a large number of sampling points as an alternative approach.
  • A participant mentions that varying the working precision can influence whether the error message occurs, noting that both very high and very low precision can lead to different outcomes.
  • One participant observes that their integrand has a logarithmic divergence in the beta->0 limit, which they believe may affect the contributions to the integral from regions near the divergence.
  • Another participant discusses the potential for integrals to have asymptotes and how precision affects the evaluation of such integrals, providing an example of an integral that remains problematic despite increasing precision.

Areas of Agreement / Disagreement

Participants express differing views on the effects of working precision and the nature of the integrand's behavior, particularly regarding divergence and asymptotic behavior. The discussion does not reach a consensus on the best approach to resolve the integration issues.

Contextual Notes

Participants note limitations related to the behavior of the integrand near certain points, such as divergences and the influence of precision settings on the evaluation of the integral, which remain unresolved.

muppet
Messages
602
Reaction score
0
Hi all,
Yet another post concerning my battle with a family of messy integrals that are standing between me and a scientific publication.

I'm defining a function by
BWdata[q_,c_,n_]:=NIntegrate[\[Beta]*BesselJ[0,q*\[Beta]]*(E^(-I*c*Gamma[n/2]*Pi^(n/2-1)/8*HypergeometricU[n/2,1,\[Beta]^2/4])-1),{\[Beta],0,Infinity},Method->{"ExtrapolatingOscillatory",Method->{"GlobalAdaptive",MaxErrorIncreases->1000}},WorkingPrecision->200,MaxRecursion->30]

For n=6 at q=0 I get the error message:
NIntegrate::inumri: The integrand (-1+E^(-(65/4) I \[Pi]^2 (1/4 (-3+Times[<<2>>])+1/4 E^Times[<<2>>] (2+Power[<<2>>]+Times[<<2>>]) Gamma[0,Times[<<2>>]]))) \[Beta] has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{0.*10^-101,5.230427695955377022882968073746754104809181670112054730607300437187234132398206612751798579662814260*10^7}}. >>

The working precision is so high because I came across this thread in which DaleSpam advised someone receiving the same error message to turn their working precision up. I was originally having problems with n=4 at q=0 as well, and increasing the working precision up to about 80 solved that. However, I'm racheting up my working precision as I type this and I'm having no luck (it's up to 700 as I type this). If I keep increasing it much higher I'm worried that the full set of integrals I have to do will start to take an inordinate amount of time. Does anyone have any other suggestions for things I could try?

The function for q=0 oscillates strongly up to a point and then decays slowly, so I tried using an oscillatory strategy over the appropriate region and then using the default method to try and tackle the rest, but to no avail.

Thanks in advance.
 
Physics news on Phys.org
Have you tried an AdaptiveQuasiMonteCarlo method, using a LOT of sampling points?

BWdata3[q_, c_, n_] :=
NIntegrate[\[Beta]*
BesselJ[0,
q*\[Beta]]*(E^(-I*c*Gamma[n/2]*Pi^(n/2 - 1)/8*
HypergeometricU[n/2, 1, \[Beta]^2/4]) - 1), {\[Beta], 0,
Infinity}, Method -> "AdaptiveQuasiMonteCarlo",
MaxPoints -> 10000000, WorkingPrecision -> 20]Also, what is your "c"? I'm trying to get your error, and am not sure what you're completely using.
 
I've been using c between 1 and 65.

I hadn't tried that, thanks for the suggestion.
 
Update: Playing about a bit, I found that having working precision too high, as well as too low, can affect whether or not I get the error message. The integrand above I call
bwintegrand[q_,\[Beta]_,c_,n_]:=\[Beta]*BesselJ[0,q*\[Beta]]*(E^(-I*c*Gamma[n/2]*Pi^(n/2-1)/8*HypergeometricU[n/2,1,\[Beta]^2/4])-1)
I find:

NIntegrate[bwintegrand[0,b,11,4],{b,0,Infinity},WorkingPrecision->30,MaxRecursion->20,Method->"ExtrapolatingOscillatory"]
-2.45281123775995660207164322961-4.55099131864809799016722004640 I

In[71]:= NIntegrate[bwintegrand[0,b,11,4],{b,0,Infinity},WorkingPrecision->50,MaxRecursion->20,Method->"ExtrapolatingOscillatory"]
During evaluation of In[71]:= NIntegrate::inumri: The integrand b (-1+E^(-(11/8) I \[Pi] (-1+(1+Times[<<2>>]) E^Times[<<2>>] Gamma[0,Times[<<2>>]]))) has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{0.*10^-50,5.2304276959553770228829680737467541048091816701121*10^7}}. >>
Out[71]= NIntegrate[bwintegrand[0,b,11,4],{b,0,\[Infinity]},WorkingPrecision->50,MaxRecursion->20,Method->ExtrapolatingOscillatory]

In[73]:= NIntegrate[bwintegrand[0,b,11,4],{b,0,Infinity},MaxRecursion->20,Method->"ExtrapolatingOscillatory"]
During evaluation of In[73]:= NIntegrate::inumri: The integrand b (-1+E^(-(11/8) I \[Pi] (-1+(1+Times[<<2>>]) E^Times[<<2>>] Gamma[0,Times[<<2>>]]))) has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{0.,5.23043*10^7}}. >>
Out[73]= NIntegrate[bwintegrand[0,b,11,4],{b,0,\[Infinity]},MaxRecursion->20,Method->ExtrapolatingOscillatory]

EDIT: It looks as if having a low precision doesn't generate this message, just too high a precision or machine precision. Bizarre.
 
Last edited:
That usually happens when there is an asymptote. The more precise you get, the closer you can get to infinity, while low precision is like having a cutoff. If your function blows up at 1.0000001 but you have only 1.00 precision, you won't blow up.

Having said that, sometimes you'll have an integral that should be convergent, but maybe includes two or more said poles. Such an example:

NIntegrate[ArcTanh[x - 1], {x, -1, 1}]

Integrate[ArcTanh[x - 1], {x, -1, 1}, GenerateConditions -> False]//N

While it is accurate, increasing the precision doesn't get rid of the error. Though it does decrease the error.
 
Thanks for the reply. My integrand is ill-defined in the beta->0 limit; it has a logarithmic divergence in the exponent, although because it's a complex exponential I figure that the regions increasingly close to the divergence contribute less and less to the integral.
 

Similar threads

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