[SciPy-User] cephes hyp1f1 vs scipy hyp1f1 stability

Samuel St-Jean Samuel.St-Jean at USherbrooke.ca
Wed Jan 7 13:05:04 EST 2015


 

 Hello fellow scipy users,

I have a problem with scipy.special.hyp1f1, where it is a bit unstable
for large negative values of x. For example, hyp1f1(a,b,x) with a=-0.5,
b=12 and z=-1406.25 gives nan (those values are from a real, legitimate
use case and not just values to make it blow up).

According to
https://github.com/scipy/scipy/blob/master/scipy/special/generate_ufuncs.py
at line 101, the wrapper implements some functions from the cephes
library and of the specfun_wrappers. Since the cephes library also
implements hyp1f1, I was wondering if anyone used it successfully or if
there is any reason to not use it. Is it more stable than the current
available version, or how would one use that version instead of the
specfun_wrapper version (or are they simply the same)? Worst case I'll
just try to wrap it with cython I guess (which is not that easy under
windows so far, but that's another issue).

mpmath also has it's own version, but it's on the slow side sadly. Any
suggestion if it would be feasible to use the cephes version or a fast,
working implementation?

Samuel 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150107/956eabfb/attachment.html>


More information about the SciPy-User mailing list