2014-05-17 12:21:31 +02:00

813 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

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

var math = mathjs();

math.factorial(5);    // returns 120
math.factorial(3);    // returns 6

See also

combinations, permutations