Mathematica 8: indeterminate result of NIntegrate

  • Mathematica
  • Thread starter muppet
  • Start date
  • Tags
    Mathematica
In summary, 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.
  • #1
muppet
608
1
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
  • #2
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
I've been using c between 1 and 65.

I hadn't tried that, thanks for the suggestion.
 
  • #4
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
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
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 to Mathematica 8: indeterminate result of NIntegrate

What is Mathematica 8?

Mathematica 8 is a software program used for mathematical computation, data analysis, and visualization. It is commonly used by scientists, engineers, and mathematicians to solve complex problems and perform calculations.

What is an indeterminate result in NIntegrate?

An indeterminate result in NIntegrate occurs when the numerical integration function is unable to find a definite value for the integral. This can happen when the function being integrated is undefined or has a singularity at one or more points within the integration interval.

Why does Mathematica 8 give an indeterminate result in NIntegrate?

There are several possible reasons for an indeterminate result in NIntegrate. Some common causes include using improper or incorrect syntax, using functions that are not defined for all values, and attempting to integrate over an infinite interval.

How can I troubleshoot an indeterminate result in NIntegrate?

If you encounter an indeterminate result in NIntegrate, the first step is to carefully check your syntax and ensure that all functions are properly defined for the values being used. You can also try adjusting the integration method or increasing the precision to see if that resolves the issue.

Is there a way to avoid getting an indeterminate result in NIntegrate?

In some cases, it may be possible to avoid an indeterminate result in NIntegrate by using alternative methods of integration or by breaking up the integration interval into smaller, more manageable pieces. You can also try using different functions or approximations to see if they produce a more accurate result.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
34
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top