Advanced

Gamma Function Calculator — Γ(z) for Any Positive Real

Calculate Γ(z) — the Gamma function — for any positive real number. At positive integers Γ(n) = (n−1)!, but Γ(z) extends the factorial smoothly to all positive reals and, via the reflection formula, to non-integer negatives.
Positive real number — try 0.5, 1, 2.5, 5 …
Γ(z)
1.329340

Computed via the Lanczos approximation (accurate to ~15 digits)

z
2.5
Γ(z)
1.32934
ln Γ(z)
0.28468287
1 / Γ(z)
0.752253
Γ(z)
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

The Gamma function Γ(z) = ∫₀^∞ t^(z−1) e^−t dt generalises the factorial to all positive reals: Γ(n) = (n−1)! for positive integers. This calculator uses the Lanczos approximation (accurate to ~15 digits) for arbitrary positive z, and also reports ln Γ(z) for use in log-space calculations.

Formula
Γ(z) = ∫₀^∞ t^(z−1) e^−t dt • Γ(n) = (n−1)! for positive integers n
How this is calculated

The Gamma function is defined by the integral Γ(z) = ∫₀^∞ t^(z−1) e^{−t} dt for positive real z. This integral cannot be expressed in terms of elementary functions for non-integer z, so numerical approximations are used in practice.

This calculator uses the Lanczos approximation (g = 7, n = 9 coefficients from Numerical Recipes), which expresses Γ(z) as √(2π) · (z + g − 0.5)^(z − 0.5) · e^{−(z+g−0.5)} · A_g(z), where A_g(z) is a rational function computed from nine pre-computed coefficients. The approximation is accurate to about 15 significant digits across all positive reals. For z < 0.5, the reflection identity Γ(z) = π / (sin(πz) · Γ(1−z)) is applied first so the core approximation always works on z ≥ 0.5 where it is most accurate.

At positive integers, Γ(n) = (n−1)! exactly: Γ(1) = 1, Γ(2) = 1, Γ(3) = 2, Γ(4) = 6, …, up to Γ(171), where the value overflows IEEE 754 double precision. The calculator also reports ln Γ(z), which grows much more slowly and remains representable for far larger arguments — useful in probability and statistics where products of gamma values are computed in log-space to avoid overflow.

Frequently asked questions

For any positive integer n, Γ(n) = (n−1)!. So Γ(1) = 0! = 1, Γ(2) = 1! = 1, Γ(3) = 2! = 2, Γ(5) = 4! = 24, and so on. The Gamma function extends this to non-integers: for example, Γ(1/2) = √π ≈ 1.7725, Γ(3/2) = √π/2 ≈ 0.8862.

Γ(z) has poles (singularities where the value approaches ±∞) at z = 0, −1, −2, −3, … The integral definition diverges at these points. At all other negative non-integer values, Γ(z) is finite and can be computed via the reflection formula.

In probability and statistics, products like Γ(a) · Γ(b) / Γ(a+b) appear in the Beta function and Dirichlet distributions. These products overflow floating-point for large a, b even when the ratio stays finite. Working in log-space — computing ln Γ(a) + ln Γ(b) − ln Γ(a+b) — avoids overflow and is the standard technique in numerical software.

Also known as

gamma function calculator
calculate gamma z
generalized factorial
lanczos gamma approximation
log gamma function
gamma of n
special function gamma

APA

TG we-Calculate Editorial Team. (2026). Gamma Function Calculator — Γ(z) for Any Positive Real [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/gamma-function-calculator

Chicago

TG we-Calculate Editorial Team. "Gamma Function Calculator — Γ(z) for Any Positive Real." TG we-Calculate. 2026. https://we-calculate.com/calculator/gamma-function-calculator.

IEEE

TG we-Calculate Editorial Team, "Gamma Function Calculator — Γ(z) for Any Positive Real," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/gamma-function-calculator

BibTeX

@misc{wecalculate_gamma_function_calculator, title = {Gamma Function Calculator — Γ(z) for Any Positive Real}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/gamma-function-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?