gamma

gamma(n)

Try it yourself:

See also:

Extend factorials with gamma

gamma(n) evaluates the gamma function, which satisfies gamma(n) = (n - 1)! for positive integers. It extends factorial-style calculations to non-integer and complex values.

Examples

gamma(6) is 120, and gamma values also exist for positive fractional inputs. This makes gamma useful in continuous probability distributions and special-function formulas. Use factorial for ordinary non-negative integer counts and lgamma for a logarithmic representation.

Domain caveats

Gamma has poles at zero and negative integers, so those inputs are undefined. Values can grow rapidly, and floating-point evaluation may lose precision near poles. round is useful for display but should not hide a near-singular input. For binomial-style quantities, combinations is normally the clearer function.

Try Gamma 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