GAMMAINC
The regularized lower incomplete gamma function gives the normalized lower-tail accumulation of the gamma kernel and is commonly used in cumulative gamma-distribution calculations.
It is defined by:
P(a,x)=\frac{1}{\Gamma(a)}\int_0^x t^{a-1}e^{-t}\,dt
for a>0 and x\ge 0. This wrapper returns the lower regularized value in [0,1].
Excel Usage
=GAMMAINC(a, x)
a(float, required): Positive shape parameter.x(float, required): Nonnegative argument.
Returns (float): Regularized lower incomplete gamma value.
Example 1: Lower incomplete gamma at origin
Inputs:
| a | x |
|---|---|
| 0.5 | 0 |
Excel formula:
=GAMMAINC(0.5, 0)
Expected output:
0
Example 2: Lower incomplete gamma at one
Inputs:
| a | x |
|---|---|
| 0.5 | 1 |
Excel formula:
=GAMMAINC(0.5, 1)
Expected output:
0.842701
Example 3: Lower incomplete gamma at moderate input
Inputs:
| a | x |
|---|---|
| 2 | 3 |
Excel formula:
=GAMMAINC(2, 3)
Expected output:
0.800852
Example 4: Lower incomplete gamma near saturation
Inputs:
| a | x |
|---|---|
| 0.5 | 10 |
Excel formula:
=GAMMAINC(0.5, 10)
Expected output:
0.999992
Python Code
from scipy.special import gammainc as scipy_gammainc
def gammainc(a, x):
"""
Compute the regularized lower incomplete gamma function.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gammainc.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 lower 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_gammainc(a, x))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Positive shape parameter.
Nonnegative argument.