GAMMA
The gamma function extends the factorial to non-integer real values through an integral definition and analytic continuation. For positive integers, it satisfies \Gamma(n+1)=n!, making it a fundamental building block in probability, statistics, and special-function identities.
For real x>0, it is defined by:
\Gamma(x)=\int_0^{\infty} t^{x-1}e^{-t}\,dt
This wrapper computes \Gamma(x) for a scalar real argument using SciPy’s special functions implementation.
Excel Usage
=GAMMA(x)
x(float, required): Real argument for the gamma function.
Returns (float): Gamma function value at the input.
Example 1: Gamma at one-half
Inputs:
| x |
|---|
| 0.5 |
Excel formula:
=GAMMA(0.5)
Expected output:
1.77245
Example 2: Gamma at six equals factorial of five
Inputs:
| x |
|---|
| 6 |
Excel formula:
=GAMMA(6)
Expected output:
120
Example 3: Gamma at positive fractional input
Inputs:
| x |
|---|
| 2.5 |
Excel formula:
=GAMMA(2.5)
Expected output:
1.32934
Example 4: Gamma at negative non-integer input
Inputs:
| x |
|---|
| -0.5 |
Excel formula:
=GAMMA(-0.5)
Expected output:
-3.54491
Python Code
from scipy.special import gamma as scipy_gamma
def gamma(x):
"""
Evaluate the gamma function for a real input.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gamma.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): Real argument for the gamma function.
Returns:
float: Gamma function value at the input.
"""
try:
return float(scipy_gamma(x))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Real argument for the gamma function.