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

sum(a, b, c, ...)
sum(A)

Parameters

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

Returns

Type Description
* The sum of all values

Examples

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

See also

mean, median, min, max, prod, std, var