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