SciPy

scipy.special.rgamma

scipy.special.rgamma(z, out=None) = <ufunc 'rgamma'>

Reciprocal of the gamma function.

Defined as \(1 / \Gamma(z)\), where \(\Gamma\) is the gamma function. For more on the gamma function see gamma.

Parameters
zarray_like

Real or complex valued input

outndarray, optional

Optional output array for the function results

Returns
scalar or ndarray

Function results

See also

gamma, gammaln, loggamma

Notes

The gamma function has no zeros and has simple poles at nonpositive integers, so rgamma is an entire function with zeros at the nonpositive integers. See the discussion in [dlmf] for more details.

References

dlmf

Nist, Digital Library of Mathematical functions, https://dlmf.nist.gov/5.2#i

Examples

>>> import scipy.special as sc

It is the reciprocal of the gamma function.

>>> sc.rgamma([1, 2, 3, 4])
array([1.        , 1.        , 0.5       , 0.16666667])
>>> 1 / sc.gamma([1, 2, 3, 4])
array([1.        , 1.        , 0.5       , 0.16666667])

It is zero at nonpositive integers.

>>> sc.rgamma([0, -1, -2, -3])
array([0., 0., 0., 0.])

It rapidly underflows to zero along the positive real axis.

>>> sc.rgamma([10, 100, 179])
array([2.75573192e-006, 1.07151029e-156, 0.00000000e+000])

Previous topic

scipy.special.psi

Next topic

scipy.special.polygamma