Gamma Function Calculator
The gamma function generalises the factorial to every real number except zero and the negative integers. For a positive integer n it equals (n minus 1) factorial, and it interpolates smoothly between those values everywhere else. This calculator evaluates the gamma function for any real input using the Lanczos approximation, a well established numerical method, and also reports the natural logarithm of the absolute value, which is useful when the gamma value itself is extremely large. Inputs at the poles return n/a.
Gamma function definition
Gamma(x) = integral from 0 to infinity of t^(x-1) e^(-t) dt, for x > 0
Gamma(n) = (n - 1)! for positive integers n
Gamma(x + 1) = x * Gamma(x)
Reflection: Gamma(x) Gamma(1 - x) = pi / sin(pi x)
This tool evaluates the integral definition numerically with the Lanczos approximation, applying the reflection formula for arguments at or below one half so negative inputs are handled.
About the gamma function
- Gamma(1) = 1 and Gamma(2) = 1, matching 0 factorial and 1 factorial.
- Gamma of one half equals the square root of pi.
- The function has simple poles at 0 and every negative integer.
- It appears in the gamma, beta, chi-squared and Student t probability distributions.
- For large arguments the value grows faster than any exponential, so the log form is reported.
Gamma function: frequently asked questions
What is the gamma function?
The gamma function extends the factorial to all real and complex numbers except the non-positive integers. For a positive integer n it satisfies gamma(n) = (n - 1) factorial, so gamma(5) equals 24.
How does this calculator compute gamma?
It uses the Lanczos approximation, a standard high-accuracy numerical method that evaluates the gamma function from a short series of fixed coefficients. The reflection formula handles negative arguments.
Why is gamma undefined at zero and negative integers?
The gamma function has poles at 0, -1, -2, -3 and so on, where it grows without bound. The calculator shows n/a at these points because no finite value exists there.
What is the relationship to factorials?
Gamma shifts the index by one: gamma(n + 1) = n factorial for non-negative integers n. So gamma(1) = 1, gamma(2) = 1, gamma(3) = 2 and gamma(4) = 6.
What is gamma of one half?
Gamma of one half equals the square root of pi, about 1.7724539. This value appears in the normal distribution and in the volume of higher-dimensional spheres.
Official sources
- NIST Digital Library of Mathematical Functions: Gamma Function: Definitions and Properties.
- NIST Digital Library of Mathematical Functions: Gamma Function: Asymptotic Expansions.
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.