simple-squiggle/node_modules/mathjs/docs/reference/functions/factorial.md

50 lines
906 B
Markdown
Raw Permalink Normal View History

<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
# Function factorial
Compute the factorial of a value
Factorial only supports an integer value as argument.
For matrices, the function is evaluated element wise.
## Syntax
```js
math.factorial(n)
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`n` | number &#124; BigNumber &#124; Array &#124; Matrix | An integer number
### Returns
Type | Description
---- | -----------
number &#124; BigNumber &#124; Array &#124; Matrix | The factorial of `n`
### Throws
Type | Description
---- | -----------
## Examples
```js
math.factorial(5) // returns 120
math.factorial(3) // returns 6
```
## See also
[combinations](combinations.md),
[combinationsWithRep](combinationsWithRep.md),
[gamma](gamma.md),
[permutations](permutations.md)