MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with NIntegrte

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47737] Re: Problem with NIntegrte
  • From: adam.smith at hillsdale.edu (Adam Smith)
  • Date: Sat, 24 Apr 2004 04:15:35 -0400 (EDT)
  • References: <c6aeog$3hu$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

This does look strange.  The problem seems to be when NIntegrate does
the negative integration range:

In[1]:=
y=BesselJ[0,x]/Sqrt[1+x^2]; 

In[2]:=
N[ Integrate[y,{x,-Infinity,Infinity}]]

Out[2]=
1.96621

In[3]:=
NIntegrate[y,{x,0,Infinity},Method ->Oscillatory]
 
Out[3]=
0.983104

In[4]:=
NIntegrate[y,{x,-Infinity,0},Method->Oscillatory]

Out[4]=
-0.982656

Based on the fact that it is an even function, the last integration
should clearly be positive and shows the origin of the erroneous
result:
 0.983104-0.982656= 0.000448.  

Note that 0.983104+0.982656 = 1.96576 is reasonably close to the .

Just another case where one really needs to be careful when doing
numerical approximations.  I am personally always a little suspicious
of NIntegrate and like to have at least a rough idea of the expected
result to check (at least in a rough sense) the result of NIntegrate. 
Yours is an excellent example.

Adam Smith



Joel Storch <jstorch at earthlink.net> wrote in message news:<c6aeog$3hu$1 at smc.vnet.net>...
> y=BesselJ[0,x]/Sqrt[1+x^2]
> 
> Integrate[y,{x,-Infinity,Infimity}] yields
>   2 BesselI[0,1/2] BesselK[0,1/2] (1.966)
> 
> 2 NIntegrate[y,{x,0,Infinity},Method->Oscillatory] gives 1.966
> (the integrand is an even function)
> 
> However,
> NIntegrate[y,{x,-Infinity,Infinity},Method->Oscillatory] gives
> 0.00044788
> 
> (Mathematica V5.1)


  • Prev by Date: Re: Re: Help: shift+enter doesn't give me any output suddenly!
  • Next by Date: Re: Distinguishable From 1.0
  • Previous by thread: Re: Problem with NIntegrte
  • Next by thread: Basic Numerical Analysis