scipy.special.gammainccinv#

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

Inverse of the regularized upper incomplete gamma function.

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

Parameters:
aarray_like

Positive parameter

yarray_like

Argument between 0 and 1, inclusive

outndarray, optional

Optional output array for the function values

Returns:
scalar or ndarray

Values of the inverse of the upper incomplete gamma function

See also

gammaincc

regularized upper incomplete gamma function

gammainc

regularized lower incomplete gamma function

gammaincinv

inverse of the regularized lower incomplete gamma function

Notes

Array API Standard Support

gammainccinv has support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.

Library

CPU

GPU

NumPy

n/a

CuPy

n/a

PyTorch

JAX

Dask

n/a

For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support out, but none of the other ufunc kwargs. out is typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend. out is never supported for JAX because JAX arrays are immutable. gammainccinv does not currently support out for the PyTorch backend.

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 infinity and monotonically decreases to 0.

>>> sc.gammainccinv(0.5, [0, 0.1, 0.5, 1])
array([       inf, 1.35277173, 0.22746821, 0.        ])

It inverts the upper incomplete gamma function.

>>> a, x = 0.5, [0, 0.1, 0.5, 1]
>>> sc.gammaincc(a, sc.gammainccinv(a, x))
array([0. , 0.1, 0.5, 1. ])
>>> a, x = 0.5, [0, 10, 50]
>>> sc.gammainccinv(a, sc.gammaincc(a, x))
array([ 0., 10., 50.])