Documentation moved.
This entry is documented with its primary interface. Open the documentation →
Function
src/index.ts:946nerdamer.factorial
nerdamer.factorial(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
core!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)"