Is there a pure Go implementation for the Hypergeometric function?

142 views
Skip to first unread message

awaw...@gmail.com

unread,
Feb 25, 2025, 4:36:45 AMFeb 25
to golang-nuts
Hi Fellow Gophers

I wonder is there a canonical implementation for the Gauss Hypergeometric function?


There's this proposal that didn't get through.
There's also this implementation, but it's unclear of its correctness.

By correctness, I mean clear documentation on the underlying algorithm used to evaluate the function.
For example, the R hypergeo package leverages the transformations listed in Abramhowitz, and applies the best one under the `tol` and `max_iterations` budget.

What package do people mostly use for statistical or mathematical work?

Jason E. Aten

unread,
Feb 25, 2025, 7:41:04 AMFeb 25
to golang-nuts
I'm not aware of one; doesn't mean a github/web search wouldn't find one though.

I usually start by looking in gonum (https://www.gonum.org/ and https://github.com/gonum/gonum )

Sadly, it appears however they don't have it: https://github.com/gonum/gonum/issues/649

Generally you end up having to roll your own. A little hassle,
but usually it turns out not to be too bad. 

Post it back to gonum or at least github, if you end up writing your own.

Best wishes,
Jason

awaw...@gmail.com

unread,
Feb 26, 2025, 2:12:43 PMFeb 26
to golang-nuts
I have submitted a pull request to gonum providing an implementation based on Cephes.
This implementation passes tests from both R's hypergeo and Python's scipy.
Reply all
Reply to author
Forward
0 new messages