UNPKG

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