a simple integral

• To: mathgroup at smc.vnet.net
• Subject: [mg68577] a simple integral
• From: dimmechan at yahoo.com
• Date: Wed, 9 Aug 2006 23:57:39 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi to all.

Let me consider the symbolical and numerical evaluation of the very
simple integral
of BesselJ[0,x] from x=0..Infinity; this integral has the well known
value 1.

In[1]:=
\$Version
Out[1=
5.2 for Microsoft Windows (June 20, 2005)

Mathematica of course, suceeds in providing this value, however with
the appearance of a strange message (strange because as it will be seen
Mathematica is able to provide a range of convergence w.r.t. the order
of  BesselJ)

In[2:=
Integrate[BesselJ[0,x],{x,0,8}]//InputForm
\!\(\*
RowBox[{\(Integrate::"gener"\), \(\(:\)\(\ \)\), "\<\"Unable to check

convergence. \\!\\(\\*
\
ButtonFrame->None, ButtonData:>\\\"Integrate::gener\\\"]\\)\"\>"}]\)
Out[2]//InputForm=
1

However, if I execute the following command

In[3]:=
Integrate[BesselJ[n,x],{x,0,8},Assumptions\[Rule]Re[n]\[Equal]0]
Out[3]//InputForm=
1

everything is Ok.

Of course, someone, knowing that the integral converges to 1, could
just supress the message

In[4]:=
Block[{Message},Integrate[BesselJ[0,x],{x,0,8}]]//InputForm
Out[4]//InputForm=
1

However, I believe this is not the case here. Why exists this message
(here)?

Moreover, consider the following command

In[5]:=
Integrate[BesselJ[n,x],{x,0,8}]//InputForm
Out[5]//InputForm=
If[Re[n] > -1, 1, Integrate[BesselJ[n, x], {x, 0, Infinity},
Assumptions -> Re[n] <= -1]]

However

In[6]:=
Integrate[BesselJ[-3,x],{x,0,8}]
>From In[6]:=
\!\(\*
RowBox[{\(Integrate::"gener"\), \(\(:\)\(\ \)\), "\<\"Unable to check

convergence. \\!\\(\\*
\
ButtonFrame->None, ButtonData:>\\\"Integrate::gener\\\"]\\)\"\>"}]\)
Out[6]=
-1

In[7]:=
Integrate[BesselJ[-4,x],{x,0,8}]
>From In[7]:=
\!\(\*
RowBox[{\(Integrate::"gener"\), \(\(:\)\(\ \)\), "\<\"Unable to check

convergence. \\!\\(\\*
\
ButtonFrame->None, ButtonData:>\\\"Integrate::gener\\\"]\\)\"\>"}]\)
Out[7]=
1

results witch are in accordance with:

In[8]:=
{BesselJ[-3,x],BesselJ[-4,x]}//InputForm
Out[8]//InputForm=
{-BesselJ[3, x], BesselJ[4, x]}

Am I missing something here?

Next, I evaluate numerically the integral. The integrand is a very
slowly convergent function.
However, the Option Method->Oscillatory cannot be applied here.

In[9]:=
NIntegrate[BesselJ[0,x],{x,0,8},Method\[Rule]Oscillatory]//InputForm
>From In[9]:=
\!\(\*
RowBox[{\(NIntegrate::"oscfm
"\), \(\(:\)\(\ \)\), "\<\"With Method->Oscillatory,
the integrand should be a
product of an oscillatory function w[x] and another function f[x] ,
as \
NIntegrate[ w[x] f[x],{x,a,Infinity}, Method->Oscillatory]. The
function w \
should be Sin, Cos, BesselJ, or BesselY, and f[x] should be of the form
a + b \
x^n for constant a and b. \\!\\(\\*ButtonBox[\\\"More...\\\", \
ButtonData:>\\\"NIntegrate::oscfm\\\"]\\)\"\>"}]\)
Out[9]//InputForm=
NIntegrate[BesselJ[0, x], {x, 0, Infinity}, Method -> Oscillatory]

In[10]:=
??Oscillatory

Oscillatory is a choice for the option Method of NIntegrate. Method ->
\
Oscillatory should be used only with integrands that contain one of the
\
following oscillating functions: w in {Sin, Cos, BesselJ, BesselY},
i.e. f[x] \
w[x], and where the 1-dimensional range of integration contains at
least one \
Infinity. The arguments to the oscillating functions should not be \
polynomials, but be some multiple of the integration variable in some
power \
(e.g. Sin[a_. x_^r_.] instead of Sin[a_. x_^r_. +b_.]). When
Bessel-functions \
are used the method might be slow.

\!\(\*
InterpretationBox[GridBox[{
{\(Attributes[Oscillatory] = {Protected}\)}
},
GridBaseline->{Baseline, {1, 1}},
ColumnAlignments->{Left}],
Definition[ "Oscillatory"],
Editable->False]\)

>From above information is not clear to me why the Option
Method->Oscillatory cannot be applied here.

As it can be found in
http://support.wolfram.com/mathematica/kernel/Symbols/System/Oscillatory.html

In[11]:=NIntegrate[Sin[x]/(1 + x^2), {x, 0, Infinity}, Method ->
Oscillatory]
Out[11]= 0.646761

is equivalent to

In[12]:= NIntegrate[Sin[x]/(1 + x^2), {x, 0, 3 Pi}] +
NSum[NIntegrate[Sin[x]/(1 + x^2), {x, k Pi, (k + 1) Pi}],
{k, 3, Infinity}, Method -> SequenceLimit,
VerifyConvergence -> False]
Out[12]= 0.646761

The mysterious become even bigger consider that Method->Oscillatory
gives the right answer
for the following integral

In[13]:=
Integrate[BesselJ[0,x]BesselJ[1,x],{x,0,8}]//InputForm
Out[13]//InputForm=
1/2

In[14]:=
Block[{Message},NIntegrate[BesselJ[0,x]BesselJ[1,x],{
x,0,8},Method\[Rule]Oscillatory]]//InputForm
Out[14]//InputForm=
0.5000000000000006

Of course the first integral can be easily obtained working as follows:

In[15]:=
Needs["NumericalMath`"]

In[16]:=
lst=BesselJZeros[0,20];

In[17]:=
lst[[0]]=0;

In[18]:=
f[n_]:=NIntegrate[BesselJ[0,x],{x,lst[[n]],lst[[n+1]]}]

In[19]:=
SequenceLimit[FoldList[Plus,0,Table[f[i],{i,0,19}]]]//InputForm
Out[19]//InputForm=
1.0000000000001095

but I keep wondering if it can be evaluated directly by Mathematica
without any "assistance".

Any help will be really appreciate.

```

• Prev by Date: How to package an array generating code
• Next by Date: Re: SImple Plot3D issue
• Previous by thread: How to package an array generating code
• Next by thread: benchmark...why don't you send it back?