1 |
|
2 |
|
3 | # Function factorial
|
4 |
|
5 | Compute the factorial of a value
|
6 |
|
7 | Factorial only supports an integer value as argument.
|
8 | For matrices, the function is evaluated element wise.
|
9 |
|
10 |
|
11 | ## Syntax
|
12 |
|
13 | ```js
|
14 | math.factorial(n)
|
15 | ```
|
16 |
|
17 | ### Parameters
|
18 |
|
19 | Parameter | Type | Description
|
20 | --------- | ---- | -----------
|
21 | `n` | number | BigNumber | Array | Matrix | An integer number
|
22 |
|
23 | ### Returns
|
24 |
|
25 | Type | Description
|
26 | ---- | -----------
|
27 | number | BigNumber | Array | Matrix | The factorial of `n`
|
28 |
|
29 |
|
30 | ## Examples
|
31 |
|
32 | ```js
|
33 | math.factorial(5) // returns 120
|
34 | math.factorial(3) // returns 6
|
35 | ```
|
36 |
|
37 |
|
38 | ## See also
|
39 |
|
40 | [combinations](combinations.md),
|
41 | [combinationsWithRep](combinationsWithRep.md),
|
42 | [gamma](gamma.md),
|
43 | [permutations](permutations.md)
|