mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
956 B
956 B
Function prod
Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.
Syntax
math.prod(a, b, c, ...)
math.prod(A)
Parameters
| Parameter | Type | Description |
|---|---|---|
args |
... * | A single matrix or or multiple scalar values |
Returns
| Type | Description |
|---|
- | The product of all values
Examples
math.multiply(2, 3) // returns 6
math.prod(2, 3) // returns 6
math.prod(2, 3, 4) // returns 24
math.prod([2, 3, 4]) // returns 24
math.prod([[2, 5], [4, 3]]) // returns 120