UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

44 lines (26 loc) 837 B
# 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 &#124; Boolean &#124; null | An integer number ### Returns Type | Description ---- | ----------- Number &#124; BigNumber &#124; Array &#124; 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) <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->