scipy.special.gammaincinv#

scipy.special.gammaincinv(a, y, out=None) = <ufunc 'gammaincinv'>#

Inverse to the regularized lower incomplete gamma function.

Given an input \(y\) between 0 and 1, returns \(x\) such that \(y = P(a, x)\). Here \(P\) is the regularized lower incomplete gamma function; see gammainc. This is well-defined because the lower incomplete gamma function is monotonic as can be seen from its definition in [dlmf].

Parameters:
aarray_like

Positive parameter

yarray_like

Parameter between 0 and 1, inclusive

outndarray, optional

Optional output array for the function values

Returns:
scalar or ndarray

Values of the inverse of the lower incomplete gamma function

See also

gammainc

regularized lower incomplete gamma function

gammaincc

regularized upper incomplete gamma function

gammainccinv

inverse of the regularized upper incomplete gamma function

Notes

gammaincinv has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

Library

CPU

GPU

NumPy

n/a

CuPy

n/a

PyTorch

JAX

⚠️ no JIT

Dask

n/a

See Support for the array API standard for more information.

References

[dlmf]

NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/8.2#E4

Examples

>>> import scipy.special as sc

It starts at 0 and monotonically increases to infinity.

>>> sc.gammaincinv(0.5, [0, 0.1 ,0.5, 1])
array([0.        , 0.00789539, 0.22746821,        inf])

It inverts the lower incomplete gamma function.

>>> a, x = 0.5, [0, 0.1, 0.5, 1]
>>> sc.gammainc(a, sc.gammaincinv(a, x))
array([0. , 0.1, 0.5, 1. ])
>>> a, x = 0.5, [0, 10, 25]
>>> sc.gammaincinv(a, sc.gammainc(a, x))
array([ 0.        , 10.        , 25.00001465])