Function reference · Math

factorial

Returns the factorial, n!.

Integers are computed exactly, and half-integers give exact values with sqrt(pi). Other numbers use the gamma function. You can also write n! or fact(n); the result is written with fact.

The largest exact input is set by MAX_FACTORIAL_INPUT (see Settings).

Notation

factorial(args)

Write it in an expression: nerdamer('factorial(5)'), or in the Playground.

nerdamer.factorial

nerdamer.factorial(...args: [x]): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

An integer.

factorial(5)
// → 120
Open in Playground

A half-integer gives an exact value.

factorial(1/2)
// → (1/2)*pi^(1/2)
Open in Playground

Other numbers use the gamma function.

evaluate(factorial(2.5))
// → 3.3233509704478425512
Open in Playground

A symbol, written with fact.

factorial(x)
// → fact(x)
Open in Playground

Also called

fact

← Back to Function reference