GAMMAINCINV

This function solves for the nonnegative argument x in the regularized lower incomplete gamma equation for a fixed positive shape parameter.

It finds x such that:

y=P(a,x)

where P(a,x) is the regularized lower incomplete gamma function. For valid inputs, the result is nonnegative and increases with y.

Excel Usage

=GAMMAINCINV(a, y)
  • a (float, required): Positive shape parameter.
  • y (float, required): Lower-tail target value in the unit interval.

Returns (float): Nonnegative x value satisfying the inverse lower incomplete gamma equation.

Example 1: Inverse lower incomplete gamma at zero probability

Inputs:

a y
0.5 0

Excel formula:

=GAMMAINCINV(0.5, 0)

Expected output:

0

Example 2: Inverse lower incomplete gamma at tenth probability

Inputs:

a y
0.5 0.1

Excel formula:

=GAMMAINCINV(0.5, 0.1)

Expected output:

0.00789539

Example 3: Inverse lower incomplete gamma at median probability

Inputs:

a y
2 0.5

Excel formula:

=GAMMAINCINV(2, 0.5)

Expected output:

1.67835

Example 4: Inverse lower incomplete gamma at one probability

Inputs:

a y
1.5 1

Excel formula:

=GAMMAINCINV(1.5, 1)

Expected output:

"Infinity"

Python Code

from scipy.special import gammaincinv as scipy_gammaincinv

def gammaincinv(a, y):
    """
    Invert the regularized lower incomplete gamma function.

    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gammaincinv.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        a (float): Positive shape parameter.
        y (float): Lower-tail target value in the unit interval.

    Returns:
        float: Nonnegative x value satisfying the inverse lower incomplete gamma equation.
    """
    try:
        if a <= 0:
            return "Error: a must be positive"
        if y < 0 or y > 1:
            return "Error: y must be between 0 and 1"
        return float(scipy_gammaincinv(a, y))
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Positive shape parameter.
Lower-tail target value in the unit interval.