lgamma

lgamma(n)

Try it yourself:

See also:

lgamma(): Logarithm of the Gamma Function

lgamma() calculates the natural logarithm of the gamma function. It is useful when gamma values are enormous, because working in logarithmic space avoids overflow in likelihoods, combinatorics, and probability distributions.

Numerical meaning

For positive integers n, gamma(n) equals (n−1)!, connecting lgamma to factorial(). Use gamma() when the unlogged value is required, and exp() to reconstruct a representable result.

Gamma has poles at zero and negative integers. Check the domain before evaluating, especially in parameter estimation, and prefer log-space subtraction over dividing giant gamma values directly.

Try Lgamma in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions