Re: Integration of BesselJ[1,z] and BesselJ[0,z]
- To: mathgroup at smc.vnet.net
- Subject: [mg41830] Re: [mg41779] Integration of BesselJ[1,z] and BesselJ[0,z]
- From: Bobby Treat <drmajorbob-MathGroup3528 at mailblocks.com>
- Date: Fri, 6 Jun 2003 09:51:03 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
The main reason to use ListPlot is that Plot will reduce things to
machine precision for speed, and that causes the problem you're seeing.
But you have done that anyway, by using a machine precision increment
(0.1), and ListPlot also reduces precision, unless you explicitly have
set the precision of your numbers.
In this plot I have focused in on the problem interval (from your
original plot), used an infinite-precision iterator, and sampled the
function more closely.
f[ts_] = Integrate[BesselJ[0, t0], {t0, 0, ts}];
Table[{ts, f[ts]}, {ts, 27, 44, 1/200}];
ListPlot[%, PlotRange -> All, PlotJoined -> True]
But no joy!!
In this one, I have cranked up the precision of the integral, before
giving it to ListPlot. Try various values of p, to see the effect.
p = 30;
f[ts_] = N[Integrate[BesselJ[0, t0], {t0, 0, ts}], p];
Table[{ts, f[ts]}, {ts, 27, 44, 1/200}];
ListPlot[%, PlotRange -> All, PlotJoined -> True]
Nice and smooth!
But using Plot loses that extra precision:
p=50;
f[ts_] = N[Integrate[BesselJ[0, t0], {t0, 0, ts}], p];
Plot[f[t], {t, 27, 44}, PlotPoints -> 200, PlotRange -> All];
Ugly again! The same thing happens if we use ListPlot and a machine
precision iterator:
p = 30;
f[ts_] = N[Integrate[BesselJ[0, t0], {t0, 0, ts}], p];
Table[{ts, f[ts]}, {ts, 27, 44, 1/200.}];
ListPlot[%, PlotRange -> All, PlotJoined -> True]
Bobby
-----Original Message-----
From: RJM <rmatyi at comcast.net>
To: mathgroup at smc.vnet.net
Subject: [mg41830] [mg41779] Integration of BesselJ[1,z] and BesselJ[0,z]
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