[SciPy-user] Possible bug in bessel special function h2vp

Julian Swartz swartzjp at gmail.com
Mon Oct 3 09:13:12 EDT 2005


Hi,

I've encountered what appears to be a bug in the function h2vp, which
calculates the nth order derivative of a hankel function of the second kind.
Here is an example with a second derivative being requested. The function
returns two different values on successive calls. Any subsequent calls will
yield the same result as the second call shown below. This problem is also
evident in function h1vp, calculating the derivatives of a hankel function
of the first kind.


>>> from scipy import *
>>> from scipy.special import *
>>> n = 1.0
>>> x = 2*0.3*pi
>>> h2vp(n, x, 2)
(2.9279764804171628e+165+0.22981683442664608j)
>>> h2vp(n, x, 2)
(-0.23515420288453626+0.54623524288750835j)

Even more interesting is that given that the hankel function of the second
kind is defined as:

(2)
H (x) = J (x) - jY (x)
n n n

Where J and Y are the standard cylindrical bessel functions of the first and
second kind. One would therefore expect that the second derivative of the
Hankel function should be the sum of the second derivatives of the ordinary
bessel functions. Using the scipy functions jvp and yvp,

>>> jvp(n, x, 2)
-0.40831349982163045
>>> yvp(n, x, 2)
-0.18651604740953789

Which is quite different to either of the results above.

Any ideas on what the problem could be. (or am I just missing something?)

Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20051003/b6c0c05f/attachment.html>


More information about the SciPy-User mailing list