[SciPy-user] [SOLVED] high precision bessel’s functions

Fredrik Johansson fredrik.johansson@gmail....
Mon Dec 8 15:05:55 CST 2008

Leonid Chaichenets wrote:

> Does anyone know an implementation of hankel2 with more precision? Can maybe
> the scaled bessel functions (scipy.special.hankel2e) be used for that
> (unfortunatly I couldnt find enough documentation on them)?

Robert Kern wrote:

> mpmath has Bessel functions. You should be able to construct the
> Hankel functions from those.

Hi, I'm the main author of mpmath and though this problem already has
been solved (thanks Robert), I thought I'd drop a comment.

Unfortunately mpmath only had the Bessel J function, and though you
can compute the other Bessel functions from it, it requires some
trickery when the order is an integer (though that shouldn't be a
problem in this case since the order was explicitly stated to be a

Since this isn't the first time someone asked for Bessel functions in
mpmath (or rather, asked for Bessel functions in a more general
setting and was pointed to mpmath) I've now implemented the Bessel I,
Y, K and Hankel H1/H2 functions, and in a way that hopefully avoids
the major numerical issues. You can get it by checking out the SVN
version. Documentation is here:

Leonid, I'd be interested to know if this implementation of the Hankel
function works for your problem. If it's not too complicated, I'd like
to add your calculation (or a simplified version thereof) to the test
suite or as a documentation example. It's always nice with real-world


More information about the SciPy-user mailing list