Mathematica 8: indeterminate result of NIntegrate

  • Mathematica
  • Thread starter muppet
  • Start date
  • #1
604
1

Main Question or Discussion Point

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.
 

Answers and Replies

  • #2
Hepth
Gold Member
448
39
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.
 
  • #3
604
1
I've been using c between 1 and 65.

I hadn't tried that, thanks for the suggestion.
 
  • #4
604
1
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:
  • #5
Hepth
Gold Member
448
39
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.
 
  • #6
604
1
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.
 

Related Threads on Mathematica 8: indeterminate result of NIntegrate

Replies
2
Views
3K
Replies
2
Views
2K
Replies
13
Views
10K
Replies
1
Views
3K
Replies
1
Views
3K
Replies
1
Views
2K
  • Last Post
Replies
5
Views
2K
Replies
3
Views
2K
Top