2016-03-19 21:07:12 +01:00

1.3 KiB

layout
default

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 #

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 #

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, var