mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
54 lines
1.4 KiB
Markdown
54 lines
1.4 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-prod">Function prod <a href="#function-prod" title="Permalink">#</a></h1>
|
|
|
|
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.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.prod(a, b, c, ...)
|
|
math.prod(A)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`args` | ... * | A single matrix or or multiple scalar values
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
* | The product of all values
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
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
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[mean](mean.html),
|
|
[median](median.html),
|
|
[min](min.html),
|
|
[max](max.html),
|
|
[sum](sum.html),
|
|
[std](std.html),
|
|
[variance](variance.html)
|