Function sum #

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

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

Parameters #

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

Returns #

Type Description
* The sum of all values

Throws #

Type | Description —- | ———–

Examples #

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, median, min, max, prod, std, variance, cumsum

Fork me on GitHub