Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,686
Registered: 2/7/05
Re: Problematic Bessely and Besselh fucntions in Matlab.
Posted: Oct 11, 2013 12:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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
answer to be.

--Nasser











Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.