
Re: Problematic Bessely and Besselh fucntions in Matlab.
Posted:
Oct 11, 2013 12:28 AM


On 10/10/2013 11:23 PM, Nasser M. Abbasi wrote: > On 10/10/2013 10:33 PM, i2000s wrote: >> Hi there, >> >> I found there is a bug in Bessel functions. For example, the Hankel function besselh >> should be defined as a combination of besselj and 1i*bessely, but in Matlab, >> this relation does not hold. I suspect, close to the origin, the besselh >> and bessely functions may not be correct. Does anyone have a tempary >> solution on this? I am using besselh and bessely to do integrals, which always fail for my studies. Thanks. >> >> Testing Commands: >> >>>> besselj(1,0.0001)+bessely(1,0.0001)*1ibesselh(1,1,0.0001) >> >> ans = >> >> 3.8982e13 > > I do not see a bug really, it seems to be just a floating point > noise issue? Unless Both Mathematica and Maple and Matlab > happen to have the same bug. The result is close to zero. > > EDU>> r=besselj(1,0.0001)+bessely(1,0.0001)*sqrt(1) > 4.99999999375e05  6366.19803645576i > > EDU>> z=besselh(1,1,0.0001) > 5.00000003273172e05  6366.19803645576i > > EDU>> rz > 3.89817152624157e13 > > > Mathematica: > BesselJ[1, 0.0001] + BesselY[1, 0.0001]*I  HankelH1[1, 0.0001]; > 0.` + 0.` I > > Maple: > restart; > BesselJ(1,0.0001)+BesselY(1,0.0001)*IHankelH1(1,0.0001); > 0. + 0. I
May be I should show the intermidate results:  r = BesselJ[1, 0.0001] + BesselY[1, 0.0001]*I 0.0000499999999375  6366.19803645576 I
HankelH1[1, 0.0001] 0.0000499999999375  6366.19803645576 I 
Same with Maple. i.e. the real part of r and the real part of Hankel first kind, is exactly the same. If this is what you mean, then, yes, there seems to be a numerical issue here. The result should have come out zero.
It depends how Hankel function was implemented in Matlab. But Maple and Mathematica do give zero, while Matlab have that small floating point result there. May be someone should look more into this.
Nasser

