Re: Integration of BesselJ[1,z] and BesselJ[0,z]
- To: mathgroup at smc.vnet.net
- Subject: [mg41820] Re: [mg41779] Integration of BesselJ[1,z] and BesselJ[0,z]
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 6 Jun 2003 09:50:50 -0400 (EDT)
- References: <200306051131.HAA02245@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
RJM wrote: > > Hello, > > I am having problems with the integration of the Bessel function of the > first kind. If I use the expression for the first order function > (BesselJ[1,z]), the function itself is just fine, showing the expected > damped oscillatory behavior starting at (x,y) = (0,0). When integrated > (Integrate [BesselJ[1, t1], {t1, 0, t}]) the result is again the expected > result with a damped oscillation converging to +1. However, if I do the same > using the zero-order function BesselJ[0,z] the starting function again looks > fine starting at (x,y) = (0,1) with damped oscillations -- but when I > integrate BesselJ[0,z], the result starts to get "noisy" after the fifth > local maximum, very noisy 6th local maximum, junping to y=0 at the 6th local > minimum. After the noisy 7th local maximum, however, the integral "settles > down" to the expected damped oscillation converging on +1!! The code to > generate plots showing this behavior is as follows: > > << Graphics`Graphics` > > Table[{e1, BesselJ[1, e1]}, {e1, 0, 50, 0.2}]; > ListPlot[%, PlotRange -> All, PlotJoined -> True] > > Integinten[t_] = Integrate [BesselJ[1, t1], {t1, 0, t}]; > Table[{t, Integinten[t]}, {t, 0, 50, 0.1}]; > ListPlot[%, PlotRange -> All, PlotJoined -> True] > > Table[{e0, BesselJ[0, e0]}, {e0, 0, 50, 0.2}]; > ListPlot[%, PlotRange -> All, PlotJoined -> True] > > Integinten[ts_] = Integrate [BesselJ[0, t0], {t0, 0, ts}]; > Table[{ts, Integinten[ts]}, {ts, 0, 50, 0.1}]; > ListPlot[%, PlotRange -> All, PlotJoined -> True] > > I have run this using version 4.0 under Windows 98 and version 4.2.1 under > Windows 2000 with nominally identical results. Any explanations on this > strange behavior or a proposed fix would be appreciated. > > Regards, > Rich Matyi If you look at the result of Integrate[BesselJ[0,t0], {t0,0,ts}] you will notice it is expressed in terms of HypergeometricPFQ. Apparently this has some numeric instabilities in evaluation. One improvement would be Integinten[ts_] = FunctionExpand[Integrate [BesselJ[0, t0], {t0, 0, ts}]]; as this will handle the numeric evaluations better in the range in question. An alternative approach would be to use dedicated numeric code to do the integration. For example you could do IntegintenN[ts_Real] := NIntegrate[BesselJ[0, t0], {t0, 0, ts}] You can instead make an "incremental" version that just integrates over successive intervals and keeps a running sum. One way to do this is as below. IntegintenN[{lo_,hi_}] := NIntegrate[BesselJ[0,t0], {t0,lo,hi}] points = Range[0,50,1/10]; intervals = Drop[Transpose[{points,RotateLeft[points]}],-1]; values = FoldList[#1+IntegintenN[#2]&, 0, intervals]; tt = Transpose[{points,values}]; ListPlot[tt, PlotRange -> All, PlotJoined -> True] Daniel Lichtblau Wolfram Research
- References:
- Integration of BesselJ[1,z] and BesselJ[0,z]
- From: "RJM" <rmatyi@comcast.net>
- Integration of BesselJ[1,z] and BesselJ[0,z]