GAMMAINCC
The regularized upper incomplete gamma function gives the normalized upper-tail accumulation of the gamma kernel and complements the lower regularized form.
It is defined by:
Q(a,x)=\frac{1}{\Gamma(a)}\int_x^{\infty} t^{a-1}e^{-t}\,dt
for a>0 and x\ge 0. It satisfies P(a,x)+Q(a,x)=1 with the lower function P.
Excel Usage
=GAMMAINCC(a, x)
a(float, required): Positive shape parameter.x(float, required): Nonnegative argument.
Returns (float): Regularized upper incomplete gamma value.
Example 1: Upper incomplete gamma at origin
Inputs:
| a | x |
|---|---|
| 0.5 | 0 |
Excel formula:
=GAMMAINCC(0.5, 0)
Expected output:
1
Example 2: Upper incomplete gamma at one
Inputs:
| a | x |
|---|---|
| 0.5 | 1 |
Excel formula:
=GAMMAINCC(0.5, 1)
Expected output:
0.157299
Example 3: Upper incomplete gamma at moderate input
Inputs:
| a | x |
|---|---|
| 2 | 3 |
Excel formula:
=GAMMAINCC(2, 3)
Expected output:
0.199148
Example 4: Upper incomplete gamma near zero tail
Inputs:
| a | x |
|---|---|
| 0.5 | 10 |
Excel formula:
=GAMMAINCC(0.5, 10)
Expected output:
0.00000774422
Python Code
from scipy.special import gammaincc as scipy_gammaincc
def gammaincc(a, x):
"""
Compute the regularized upper incomplete gamma function.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gammaincc.html
This example function is provided as-is without any representation of accuracy.
Args:
a (float): Positive shape parameter.
x (float): Nonnegative argument.
Returns:
float: Regularized upper incomplete gamma value.
"""
try:
if a <= 0:
return "Error: a must be positive"
if x < 0:
return "Error: x must be nonnegative"
return float(scipy_gammaincc(a, x))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Positive shape parameter.
Nonnegative argument.