simple-squiggle/node_modules/mathjs/docs/reference/functions/prod.md

1008 B

Function prod

Compute the product 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.prod(a, b, c, ...)
math.prod(A)

Parameters

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

Returns

Type Description
  • | The product of all values

Throws

Type Description

Examples

math.multiply(2, 3)           // returns 6
math.prod(2, 3)               // returns 6
math.prod(2, 3, 4)            // returns 24
math.prod([2, 3, 4])          // returns 24
math.prod([[2, 5], [4, 3]])   // returns 120

See also

mean, median, min, max, sum, std, variance