[SciPy-Dev] Reimplementing hypergeometric functions

Evgeni Burovski evgeny.burovskiy at gmail.com
Thu Jan 7 16:45:03 EST 2016


Hi Ted, Hi Joshua, Hi Nikolay,

First things first: Great to see you guys working on this!

I don't have technical insights to offer; I'd only say that from ten
thousand feet it looks like you guys could consider setting up a
shared repo for your collaborative efforts. Either one your scipy
forks, or a separate repo, whichever works for you guys.
That would reduce the chances of ending up with several more
unfinished masterpieces :-).

Cheers,

Evgeni




On Thu, Jan 7, 2016 at 8:15 PM, Joshua Wilson
<josh.craig.wilson at gmail.com> wrote:
> I was working on reimplementing hyp1f1, but then my efforts stalled. I ran
> into three primary issues:
>
> (1) Really small b values. (b < 1e-16, IIRC.) For moderately sized a the
> terms of the Taylor series get very large before the factorial finally kills
> them, so you get a lot of cancellation. Still, the loss in accuracy was only
> a couple of digits beyond what was required for passing the current tests,
> so perhaps this is not worth worrying about. The ideas from the paper for
> small b (single fraction) did not seem to improve the situation when b was
> this small.
>
> (2) Arguments close to the imaginary axis. For moderate a the Taylor series
> has a lot of cancellation again. The current implementation tries to fix
> this issue by using a recurrence relation to decrease a, but that recurrence
> relation becomes unstable for numbers with nonpositive real part. In gh-5349
> Miller's algorithm was suggested as a possible fix, but in this scenario
> there is no minimal solution (see the book "Numerical Methods for Special
> Functions" by Gil, Segura, and Temme), so Miller's algorithm is a no-go. I
> was planning on using a double recursion to try and fix this, but I never
> got around to implementing it...
>
> (3) Stitching it all together. Trying to get something that worked for all
> of the regimes and was still readable/maintainable was tricky.
>
> But I didn't contact the authors! I was just working directly from the
> paper; maybe they've already solved all of these issues in their
> implementation!
>
> I would like to see this project completed, so I would be glad to help in
> whatever way I can. FWIW I implemented a lot of the methods in the paper (in
> pure Python); let me know if you want any of that code.
>
> - Josh
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/scipy-dev
>



More information about the SciPy-Dev mailing list