--- layout: default ---

Function prod #

Compute the product of a matrix or a list with values. In case of a multidimensional array or matrix, the sum of all elements will be calculated.

Syntax #

```js 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

Throws #

Type | Description ---- | -----------

Examples #

```js 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 ```

See also #

[mean](mean.html), [median](median.html), [min](min.html), [max](max.html), [sum](sum.html), [std](std.html), [variance](variance.html)