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


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
Are you asking why you are not getting an exact zero? or much closer to zero than what Matlab does now? When you say the answer is wrong, it help to say what you expect the correct answer to be.
Nasser

