Documentation moved.
This entry is now part of the unified function reference. Open the unified page →
Function
src/index.ts:804nerdamer.gamma
nerdamer.gamma(x: Expression): ExpressionComputes the gamma function Γ(x). - For positive integers:
`Γ(n) = (n − 1)!`- For half-integers (e.g.
`1/2`,
`3/2`,
`-3/2`): returns a closed-form expression involving
`sqrt(π)`. - For other numeric values: uses a high-precision decimal approximation. - For symbolic inputs: returns an unevaluated
`gamma(x)`node.
throws
UndefinedError If
`x`is
`-∞`.
see
https://en.wikipedia.org/wiki/Gamma_function
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | The input expression. |
Returns
Expression — The gamma function value Γ(x).
Examples
gamma(Expression.create(5)).text() // "24"
gamma(Expression.create('1/2')).text() // "sqrt(pi)"
gamma(Expression.create('x')).text() // "gamma(x)"