[SciPy-dev] Bessel functions from Boost

Pauli Virtanen pav@iki...
Mon Feb 9 04:26:50 CST 2009

Mon, 09 Feb 2009 01:20:11 -0800, Ondrej Certik wrote:
> Right. For double precision I think mpmath is not so fast. Fredrik, is
> it difficult to make mpmath fast even for double precision?
> Last time I asked:
> http://groups.google.com/group/mpmath/browse_thread/thread/
> you replied:
> "
> SciPy already provides a truckload of machine precision special
> functions, with excellent (fast and robust) implementations. It'd be
> hard to top that.
> "
> But apparently, maybe mpmath can be useful.

I'd say that mpmath faces the same robustness and testing issues as Scipy 
with regard to special functions. (In addition, since it's written in 
Python, I'd assume it also faces additional performance issues.)

Also, algorithms that work well in arbitrary precision might not work for 
limited precision, due to loss of precision or under/overflows in 
intermediate steps. Looking at the Bessel function implementations in 
mpmath/functions.py, I'd say that at least besselj and besseli would face 
overflow issues for large arguments if they were working in double 
precision. This kind of issues are actually the most difficult to get 

To clarify: Definitely I think that mpmath is great work, and I'm happy 
to see people working on it, including improvements to its special 
function library.

But at the present, I think the path of least resistance for Scipy is to 
continue using, testing, and improving existing implementations of 
special function codes, written in C or F77, directly for limited 

Pauli Virtanen

More information about the Scipy-dev mailing list