scipy.special.log_gammaincc#

scipy.special.log_gammaincc(a, x, out=None) = <ufunc 'log_gammaincc'>#

Logarithm of the regularized upper incomplete gamma function.

Defined as

\[\log Q(a, x) = \log \frac{1}{\Gamma(a)} \int_x^{\infty} t^{a-1} e^{-t} dt\]

for \(a > 0\) and \(x \geq 0\). This function is more accurate than computing log(gammaincc(a, x)) directly when the survival function value is very small.

Parameters:
aarray_like

Positive real parameter.

xarray_like

Nonnegative real argument.

outndarray, optional

Optional output array for the function values.

Returns:
scalar or ndarray

Values of the log of the regularized upper incomplete gamma function.

See also

gammainc

regularized lower incomplete gamma function

gammaincc

regularized upper incomplete gamma function

log_gammainc

log of the regularized lower incomplete gamma function

Notes

This function wraps the lgamma_q routine from the Boost Math C++ library [1].

References

[1]

The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.

Examples

>>> import numpy as np
>>> from scipy.special import log_gammaincc, gammaincc

For very small survival function values, log(gammaincc(a, x)) underflows to -inf while log_gammaincc retains precision:

>>> with np.errstate(divide='ignore'):
...     print(np.log(gammaincc(10, 1000.0)))
-inf
>>> log_gammaincc(10, 1000.0)
-950.622998370156