[SciPy-User] docs: properties of special functions

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Sep 4 14:41:07 EDT 2012


The scipy.special special function docstrings are very skinny.

What's a good source to quickly find some properties of the special functions?

---
For example, the distributions make heavy use of the special
functions, but I'm finding derivatives only by accident:

What's the derivative of i0?  answer ask mpmath documentation

>>> mp.besseli(0, 1, derivative=0)
mpf('1.2660658777520084')
>>> mp.besseli(0, 1, derivative=1)
mpf('0.56515910399248503')

>>> special.i0(1)
1.2660658777520082
>>> special.i1(1)
0.56515910399248515

What's the derivative of gamma and loggamma?  ask sympy

>>> import sympy as sy
>>> sy.diff(sy.gamma(a), a)
gamma(a)*polygamma(0, a)
>>> sy.diff(sy.loggamma(a), a)     #unknown derivative ?
D(loggamma(a), a)

>>> import statsmodels.tools.numdiff as nd
>>> nd.approx_fprime_cs(np.array([5.]), special.gammaln).item()
1.5061176684318003
>>> special.polygamma(0,5)
array(1.5061176684318003)

but going through the list in scipy.special, I actually find
"derivative of the logarithm of the gamma function"

>>> special.psi(5)
1.5061176684318003

Josef



More information about the SciPy-User mailing list