Re: Numerical Integration
- To: mathgroup at smc.vnet.net
- Subject: [mg71528] Re: Numerical Integration
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Wed, 22 Nov 2006 05:22:11 -0500 (EST)
- References: <ejrn8h$9a4$1@smc.vnet.net><ejuqhi$huo$1@smc.vnet.net>
Peter thanks again for your newer solution. Below I also give my final approach ($Version Number->5.2) (Pentium 4, CPU 2.80 GHz, 512MB Ram) Needs["NumericalMath`BesselZeros`"] h[x_] := Tan[BesselJ[0, x]] Needs["NumericalMath`BesselZeros`"] lst[n_] := Prepend[BesselJZeros[0, n], 0]; int[n_, i_, nopts___] := NIntegrate[h[x], {x, lst[n][[i]], lst[n][[i + 1]]}, nopts] tab[n_, nopts___] := Table[int[n, i, nopts], {i, 1, n - 1}] sumint[n_, nopts___] := SequenceLimit[FoldList[Plus, 0, tab[n, nopts]]] (Prepend[Timing[sumint[#1, PrecisionGoal -> 32, WorkingPrecision -> (6*32)/5]], #1] & ) /@ (2^Range[2, 7]) {{4, 0.375*Second, 1.3643699115048195797`2.1072099696478674}, {8, 2.062000000000012*Second, 1.4544903415612941044`4.816479930623699}, {16, 7.8279999999999745*Second, 1.4545130030320762838486550491`12.34222982222323}, {32, 13.297000000000025*Second, 1.4545130030326107638283270574106180434`23.480339661790534}, {64, 28.546999999999912*Second, 1.45451300303261076382832929894487094148`24.98548964011044}, {128, 67.82800000000009*Second, 1.45451300303261076382832936146487729718`26.189609622766366}} TableForm[%] Best Regards Dimitris dimitris wrote: > Peter I apologize for the situation. > My thanks was for you but somehow I confused the names! > > Best Regards > Dimitris > > dimitris wrote: > > Dear David, > > > > Thanks a lot for your nice solution. > > > > Here is another along the same lines. > > > > h[x_] := Tan[BesselJ[0, x]] > > > > Needs["NumericalMath`BesselZeros`"] > > > > lst = BesselJZeros[0, 10]; > > lst[[0]] = 0; > > > > f[i_] := NIntegrate[h[x], {x, lst[[i]], lst[[i + 1]]}] > > > > SequenceLimit[FoldList[Plus, 0, Table[f[i], {i, 0, 9}]]] > > 1.45451 > > > > > > Best Regards > > Dimitris > > > > Peter Pein wrote: > > > 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