Documentation moved.
This entry is now part of the unified function reference. Open the unified page →
Function
src/index.ts:788nerdamer.fact
nerdamer.fact(x: Expression): ExpressionComputes the factorial of an expression. For non-negative integers, returns the exact integer factorial. For half-integer arguments (e.g.
`1/2`,
`3/2`,
`-1/2`), returns a closed-form expression involving
`sqrt(π)`. When
`Settings.EVALUATE`is
`true`and the input is not an integer, falls back to the gamma function via Γ(x + 1).
throws
UndefinedError If
`x`is
`-∞`.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | The expression to compute the factorial of. |
Returns
Expression — The factorial of `x`.
Examples
factorial(Expression.create(5)).text() // "120"
factorial(Expression.create(0)).text() // "1"
factorial(Expression.create('1/2')).text() // "1/2*sqrt(pi)"