Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Problematic Bessely and Besselh fucntions in Matlab.
Replies: 2   Last Post: Oct 11, 2013 12:28 AM

 Messages: [ Previous | Next ]
 Nasser Abbasi Posts: 6,677 Registered: 2/7/05
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)*1i-besselh(1,1,0.0001)
>
> ans =
>
> -3.8982e-13

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.99999999375e-05 - 6366.19803645576i

EDU>> z=besselh(1,1,0.0001)
5.00000003273172e-05 - 6366.19803645576i

EDU>> r-z
-3.89817152624157e-13

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)*I-HankelH1(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

--Nasser

Date Subject Author
10/10/13 Xiaodong
10/11/13 Nasser Abbasi
10/11/13 Nasser Abbasi