Gamma Function Approximation

Evaluate positive real Γ(x) and log Γ(x) by Lanczos/reflection approximation over bounded finite domain; negative poles and complex continuation intentionally excluded.

Description

The gamma function extends factorial values to positive real arguments: Γ(n)=(n−1)!

The gamma function extends factorial values to positive real arguments: Γ(n)=(n−1)! for positive integers. Its logarithm is useful when gamma itself grows large.1, 2

Evaluate positive real Γ(x) and log Γ(x) by Lanczos/reflection approximation over bounded finite domain; negative poles and complex continuation intentionally excluded.

When to use Gamma Function Approximation

Use this tool to evaluate positive real Γ(x) and log Γ(x) by Lanczos/reflection approximation over bounded finite domain; negative poles and complex continuation intentionally excluded.

Choose the integer, sequence, coefficients or function parameters for your calculation. Follow the stated ordering, domain and size limits.

How to use Gamma Function Approximation and understand its results

  1. Choose the integer, sequence, coefficients or function parameters for your calculation. Follow the stated ordering, domain and size limits.
  2. Enter x using the field table and calculation rules, then run the tool.
  3. Read gammaValue, logGammaValue. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
xXnumberRequired

Enter x in [0.0001,170]. Evaluate log gamma with the Lanczos approximation, using the reflection relation for x<0.5, then return gamma and its natural logarithm.

Γ(x)=exp(log Γ(x))

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
gammaValueGamma valuenumber
logGammaValueLog gamma valuenumber
json
{
  "input": {
    "x": 0.5
  },
  "output": {
    "gammaValue": 1.772453850905515,
    "logGammaValue": 0.5723649429246995
  }
}

Limitations and assumptions

Negative poles and complex continuation are excluded. The returned approximation is not arbitrary precision.

Numeric inputs and returned numeric values must be finite; an unrepresentable returned value produces an error. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use Digamma Approximation: Evaluate real positive digamma ψ(x) using upward recurrence and Bernoulli-corrected large-argument expansion, not finite-difference differentiation or negative-pole continuation. For a complementary task, use Beta Function Approximation: Evaluate positive real beta function and stable logarithm from Lanczos log gamma; no probability distribution sampling or continuation across beta poles.

Further background: Gamma function: definitions.

References

  1. Gamma Function Approximation — tool.io

  2. Gamma function: definitions — NIST Digital Library of Mathematical Functions

Similar or alternative tools

  • Digamma Approximation

    Evaluate real positive digamma ψ(x) using upward recurrence and Bernoulli-corrected large-argument expansion, not finite-difference differentiation or negative-pole continuation.

  • Beta Function Approximation

    Evaluate positive real beta function and stable logarithm from Lanczos log gamma; no probability distribution sampling or continuation across beta poles.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies