Skip to content

gammaincinv

specfun · scripts/specfun/gammaincinv.m

: x = gammaincinv (y, a)
: x = gammaincinv (y, a, tail)

Inverse of the regularized incomplete gamma function.

For tail equal to "lower" (default) return the non-negative x with gammainc (x, a) == y; for "upper" return x with gammainc (x, a, "upper") == y.

y must lie in [0, 1] and a must be positive. The arguments must have the same size or be scalars. The equation is solved for log (x) by a safeguarded Newton iteration on the logarithm of the smaller of the two tails, so tiny and huge results keep full relative accuracy.