[SciPy-Dev] Reimplementing hypergeometric functions

Ted Pudlik tpudlik at gmail.com
Thu Jan 7 21:00:07 EST 2016


Hi,

Thank you all for your responses!

Josh, Nikolay, it would be great if you could share what code you already
have.  Following Evgeni's recommendation, I'll add you as collaborators to
my scipy fork and we can take it from there.  (Please let me know if
another arrangement would work better!)

I sent an email to John Pearson, the first author of the aforementioned
arXiv 1407.7786, asking for a license-compatible copy of their code and any
advice on stitching the algorithms together.  I will let you know if I hear
back from him.

Best wishes,
Ted


On Thu, Jan 7, 2016 at 4:45 PM Evgeni Burovski <evgeny.burovskiy at gmail.com>
wrote:

> 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
> >
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20160108/544c0ef1/attachment.html>


More information about the SciPy-Dev mailing list