Gamma Function Calculator
Evaluate the gamma function Γ(x) for any real number, along with its natural logarithm. Γ(x) extends the factorial to non-integers and negative numbers — Γ(n) = (n-1)! for positive integers n.
Input
Output
| Function | Value |
|---|---|
| No data yet | |
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/gamma-function-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"x": "5"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `gamma-function-calculator` tool (Gamma Function Calculator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/gamma-function-calculator/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="Gamma Function Calculator — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per API/MCP call | From 5 credits |
|---|---|
| Need more credits? | View pricing |
Also available with
Guides
What does this calculator do?
Enter a real number x and this tool computes Γ(x), the gamma function, along with its natural logarithm ln|Γ(x)|. The gamma function extends the factorial to non-integer and negative real numbers: for a positive integer n, Γ(n) = (n-1)!. It's evaluated with a Lanczos approximation accurate to roughly 14-15 significant digits.
How to use it
- Enter a value for x, between -50 and 170 — outside that range the true value either underflows toward zero or overflows what a 64-bit floating-point number can represent.
- Read Γ(x) and ln|Γ(x)| from the result table. The log column is useful once Γ(x) itself gets astronomically large (by x = 100, Γ(x) is already over 10¹⁵⁵) — its logarithm stays a normal-sized number you can actually compare.
The math
For positive real x, the gamma function is defined by the improper integral:
Γ(x) = ∫₀^∞ t^(x-1) · e^(-t) dtwhich satisfies the recurrence Γ(x+1) = x · Γ(x), the same relationship the factorial follows — so Γ(1) = 1, Γ(2) = 1, Γ(3) = 2, Γ(4) = 6, and in general Γ(n) = (n-1)! for positive integers.
For non-integers, Γ(0.5) = √π ≈ 1.7725, and half-integer values follow Γ(n + 1/2) formulas built from that. For negative non-integers, Euler's reflection formula extends the function:
Γ(x) · Γ(1-x) = π / sin(πx)which is how this calculator handles x < 0.5 — it computes Γ(1-x) with the same Lanczos approximation and solves for Γ(x). The function is undefined at zero and every negative integer (poles, where sin(πx) = 0 makes the denominator vanish) — the calculator rejects those inputs with an error rather than showing an incorrect result.
Example use cases
- Combinatorics and probability — the gamma function underlies the gamma distribution, beta distribution, and Student's t-distribution, all of which need Γ evaluated at non-integer arguments (like half-integer degrees of freedom).
- Combinatorial formulas with non-integer arguments — the generalized binomial coefficient and Stirling-type approximations extend naturally through Γ(x) rather than being restricted to whole-number factorials.
- Physics and engineering — Γ(x) shows up in normalization constants for Maxwell-Boltzmann and Bose-Einstein statistics, and in solutions to certain differential equations.
- Checking factorial values quickly — since
Γ(n) = (n-1)!, entering x = 11 gives you10! = 3628800without needing a separate factorial calculator.
Privacy
All calculations run locally in your browser — your input is never sent to a server.
Related tools
For the closely related error function, see the Complementary Error Function Calculator. For general descriptive statistics, see the Statistics Calculator.