Statistical shortcomings in standard math libraries (and how to fix them)
evanmiller.org
evanmiller.org
GSL's design doc (https://www.gnu.org/software/gsl/design/gsl-design.html) explicitly names many libraries, including CEPHES, that its creators consider useful but with drawbacks, such as non-free licensing, that motivated GSL's creation.
I'm not especially familiar with GSL except for a few functions I've used on occasion, and not with CEPHES at all, so I can't speak to other pros or cons.
This. The author should have at least mentioned the ubiquituous and reasonably well-maintained GNU Scientific Library (GSL) [1], which already implements all the functions listed in the article [2,3,4,5], among many, many other things [6].
[1] http://www.gnu.org/software/gsl/
[2] http://www.gnu.org/software/gsl/manual/html_node/Incomplete-...
[3] http://www.gnu.org/software/gsl/manual/html_node/Incomplete-...
[4] http://www.gnu.org/software/gsl/manual/html_node/The-Gaussia...
[5] http://www.gnu.org/software/gsl/manual/html_node/Bessel-Func...
Admittedly it adds a little extra friction to the process, but this doesn't seem like an insurmountable problem off hand.
Things like Quantlib and jQuantlib also provide a lot of mathematical/numerical algorithms. Yeah, it's a drag having to pull in another library, but at least these things exist. :-)
[1]: http://commons.apache.org/proper/commons-math/index.html
If I have time this summer, I'll implement the Gamma and Beta functions, and their inverses, with a permissive license.
You really think we need stats functions in libc more than we need, say, properly written accelerated vector and matrix functions? Which do you think comes up more regularly in practice?
You're better off reimplementing these handful of functions in a BSD-licensed copy-lib and forgetting about it. None of these are particularly tricky to implement.
Empirically, many language environments (think, e.g. scripting languages) don't have really easy access to all of these functions, but do have easy access to most of the rest of libm. The author is saying that if these were part of libm, then language implementers would include them in their respective standard libraries, and then people that care about stats (and many of us should care about stats!) could write good stats software in general purpose languages that we might have chosen for some independent reason.
> You really think we need stats functions in libc more than we need, say, properly written accelerated vector and matrix functions?
Can't we have both?
True, although I suspect there's probably a certain amount of historical accident to the set of functions included in math.h. There's a strong argument that some of these common 'special' functions are at least as fundamental to a variety of mathematical fields as (say) arc hyperbolic cosine, although admittedly it'd probably be hard to get clear consensus on exact which.
I expect if you asked a variety of stats/ML geeks they might have other priorities to those given here -- e.g. I might request the digamma and trigamma functions (first and second derivatives of log gamma, useful for computing gradients in various Bayesian models) before asking for Bessel functions, say. It might also be sensible to prefer log-domain versions of some of the functions he suggests, since much practical computation with probabilities needs to happen in the log domain.
Almost every mathematical function is hard to implement, if you want an implementation that is correct and (about) as fast as possible. For example, see http://www.boost.org/doc/libs/1_55_0/libs/math/doc/html/math..., which explains how boost implements the Bessel functions.
(By the way, I think boost math special functions is that 'BSD'-licensed library you are asking for)