# Function sum

Compute the sum 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

```js
math.sum(a, b, c, ...)
math.sum(A)
```

### Parameters

Parameter | Type | Description
--------- | ---- | -----------
`args` | ... * | A single matrix or or multiple scalar values

### Returns

Type | Description
---- | -----------
* | The sum of all values


## Examples

```js
math.sum(2, 1, 4, 3);               // returns 10
math.sum([2, 1, 4, 3]);             // returns 10
math.sum([[2, 5], [4, 3], [1, 7]]); // returns 22
```


## See also

[mean](mean.md),
[median](median.md),
[min](min.md),
[max](max.md),
[prod](prod.md),
[std](std.md),
[var](var.md)


<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
