MathGroup Archive 2006

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

Search the Archive

Re: Numerical Integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71505] Re: Numerical Integration
  • From: Peter Pein <petsie at dordos.net>
  • Date: Tue, 21 Nov 2006 07:05:03 -0500 (EST)
  • Organization: 1&1 Internet AG
  • References: <ejrn8h$9a4$1@smc.vnet.net> <ejs36f$906$1@smc.vnet.net>

Peter Pein schrieb:
> dimitris schrieb:
>> Dear All,
>>
>> I have one question about the numerical integration of one function.
>>
>> $VersionNumber
>> 5.2
>>
> ....
>> h[x_] := Tan[BesselJ[0, x]]
>>
>> Plot[h[x], {x, 0, 40}, PlotPoints -> 100, Axes -> None, Frame -> {True,
>> True, False, False}, PlotStyle -> AbsoluteThickness[2]]
>>
>> Limit[h[x], x -> Infinity]
>> 0
>>
>> I try hard to find any proper settings for getting a numerical
>> estimation of its integral
>> over {0,Infinity} but I can't succeed.
>>
>> Any help will be greatly appreciate.
>>
>> Dimitris
>>
> 
> Hi Dimitris,
> 
> I tried it this way:
> 
> In[1]:=
> Needs["NumericalMath`BesselZeros`"];
> h[x_] := Tan[BesselJ[0, x]];
> t0 = SessionTime[];
> bzlist = NestList[BesselJZerosInterval[0, {1, 2}*Last[#1] + {-1/10, 1/10}] & ,
>     Flatten[{0, BesselJZeros[0, 2]}], 9];
> v0 = (NIntegrate[h[x], Evaluate[Flatten[{x, #1}]]] & ) /@ bzlist;
> SequenceLimit[Rest[FoldList[Plus, 0, v0]]]
> (SessionTime[] - t0)*seconds
> Out[6]=
> 1.4545133229307878
> Out[7]=
> 1.75*seconds
> 
> The displayed result (1.45451) does not change any more when increasing the
> number of intervals from 9 to 10 or more.
> 
> Peter
> 

Hi,

 I revisited this problem; there's no need for BesselJZeros, because the
distance of consecutive zeros approaches Pi for large x:

Pi+Subtract@@BesselJZeros[0,{1000,1001}]
--> 3.976868967470182*^-8

So I got this "oneliner":

In[1]:=
tanbessint[iter_Integer, prec_:16] :=
  NumberForm[
   SequenceLimit[
    Rest[FoldList[Plus, 0,
      (NIntegrate[Tan[BesselJ[0, x]], Evaluate[Flatten[{x, #1}]], MaxRecursion
-> 1000, WorkingPrecision -> (6*prec)/5, PrecisionGoal -> prec] & ) /@
       Partition[Pi*Range[0, iter], 2, 1]]]],
   {prec + 3, prec}]
In[2]:=
(Timing[tanbessint[#1, 32]] & ) /@ (2^Range[2, 7])
Out[2]= (* NumberForm removed *)
{{0.454*Second, 1.4649554394371646816`2.1072099696478666},
 {1.734*Second, 1.4545166609457239891`5.41853992195166},
 {5.094*Second, 1.4545130030326380662306103487`13.546349804879155},
 {6.859*Second, 1.45451300303261076382833017427860887836`24.082399653118497},
 {9.672*Second, 1.45451300303261076382832940251018898863`25.28651963577442},
{14.969*Second, 1.45451300303261076382832936767875149309`26.490639618430347}}


Well, the demanded precision of 32 digits has not been reached but more than
25 digits should be sufficient for most purposes.

Peter


  • Prev by Date: Re: ComplexityFunction affects set of transformations tried by Simplify
  • Next by Date: Re: General--Trigonometric functions manipulations in Mathematica
  • Previous by thread: Re: Numerical Integration
  • Next by thread: Re: Numerical Integration