mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
43 lines
809 B
Markdown
43 lines
809 B
Markdown
<!-- 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 | BigNumber | Array | Matrix | An integer number
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | BigNumber | Array | Matrix | The factorial of `n`
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.factorial(5); // returns 120
|
|
math.factorial(3); // returns 6
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[combinations](combinations.md),
|
|
[gamma](gamma.md),
|
|
[permutations](permutations.md)
|