Gamma Function Calculator
Test cases replayed : 5 of 5 match · Methodology · No outside source listed
Enter a real number to get the gamma function Γ(x), the extension of the factorial to non-integers, and the natural log of its absolute value.
Result
Γ(x)
Γ(x) to 10 decimals
- ln |Γ(x)|
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- x (real number, not 0 or a negative integer): enter a number.
- Read the result: Γ(x); the panel also shows Γ(x) to 10 decimals and ln |Γ(x)|.
How this calculator works
The gamma function is Γ(x) = ∫₀^∞ t^(x−1) e^(−t) dt. It satisfies Γ(x + 1) = x Γ(x) and Γ(1) = 1, so Γ(n) = (n − 1)! for every positive whole number n. It is undefined at 0 and at negative integers.
The value is computed with the Lanczos approximation (g = 7, nine coefficients), accurate to about 15 significant digits. For x < 1/2 the reflection formula Γ(x) Γ(1 − x) = π / sin(πx) is used (NIST Digital Library of Mathematical Functions, chapter 5).
Worked example
| x (real number, not 0 or a negative integer) | 4.5 |
|---|
| Γ(x) | 11.6317 |
|---|---|
| Γ(x) to 10 decimals | 11.6317283966 |
| ln |Γ(x)| | 2.4537 |
Frequently asked questions
What is Γ(1/2)?
Γ(1/2) = √π ≈ 1.7725.
How is the gamma function related to the factorial?
Γ(n) = (n − 1)! for whole numbers, so Γ(5) = 4! = 24. Γ(4.5) ≈ 11.6317 lies between 3! = 6 and 4! = 24.