UNPKG

1.11 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function mean
4
5Compute the mean value of matrix or a list with values.
6In case of a multi dimensional array, the mean of the flattened array
7will be calculated. When `dim` is provided, the maximum over the selected
8dimension will be calculated. Parameter `dim` is zero-based.
9
10
11## Syntax
12
13```js
14math.mean(a, b, c, ...)
15math.mean(A)
16math.mean(A, dim)
17```
18
19### Parameters
20
21Parameter | Type | Description
22--------- | ---- | -----------
23`args` | ... * | A single matrix or or multiple scalar values
24
25### Returns
26
27Type | Description
28---- | -----------
29* | The mean of all values
30
31
32## Examples
33
34```js
35math.mean(2, 1, 4, 3) // returns 2.5
36math.mean([1, 2.7, 3.2, 4]) // returns 2.725
37
38math.mean([[2, 5], [6, 3], [1, 7]], 0) // returns [3, 5]
39math.mean([[2, 5], [6, 3], [1, 7]], 1) // returns [3.5, 4.5, 4]
40```
41
42
43## See also
44
45[median](median.md),
46[min](min.md),
47[max](max.md),
48[sum](sum.md),
49[prod](prod.md),
50[std](std.md),
51[variance](variance.md)