1 |
|
2 |
|
3 | # Function prod
|
4 |
|
5 | Compute the product of a matrix or a list with values.
|
6 | In case of a (multi dimensional) array or matrix, the sum of all
|
7 | elements will be calculated.
|
8 |
|
9 |
|
10 | ## Syntax
|
11 |
|
12 | ```js
|
13 | math.prod(a, b, c, ...)
|
14 | math.prod(A)
|
15 | ```
|
16 |
|
17 | ### Parameters
|
18 |
|
19 | Parameter | Type | Description
|
20 | --------- | ---- | -----------
|
21 | `args` | ... * | A single matrix or or multiple scalar values
|
22 |
|
23 | ### Returns
|
24 |
|
25 | Type | Description
|
26 | ---- | -----------
|
27 | * | The product of all values
|
28 |
|
29 |
|
30 | ## Examples
|
31 |
|
32 | ```js
|
33 | math.multiply(2, 3) // returns 6
|
34 | math.prod(2, 3) // returns 6
|
35 | math.prod(2, 3, 4) // returns 24
|
36 | math.prod([2, 3, 4]) // returns 24
|
37 | math.prod([[2, 5], [4, 3]]) // returns 120
|
38 | ```
|
39 |
|
40 |
|
41 | ## See also
|
42 |
|
43 | [mean](mean.md),
|
44 | [median](median.md),
|
45 | [min](min.md),
|
46 | [max](max.md),
|
47 | [sum](sum.md),
|
48 | [std](std.md),
|
49 | [variance](variance.md)
|