max.md (1295B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function max 4 5 Compute the maximum value of a matrix or a list with values. 6 In case of a multi dimensional array, the maximum 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.max(a, b, c, ...) 15 math.max(A) 16 math.max(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 maximum value 30 31 32 ### Throws 33 34 Type | Description 35 ---- | ----------- 36 37 38 ## Examples 39 40 ```js 41 math.max(2, 1, 4, 3) // returns 4 42 math.max([2, 1, 4, 3]) // returns 4 43 44 // maximum over a specified dimension (zero-based) 45 math.max([[2, 5], [4, 3], [1, 7]], 0) // returns [4, 7] 46 math.max([[2, 5], [4, 3]], [1, 7], 1) // returns [5, 4, 7] 47 48 math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1 49 math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5 50 ``` 51 52 53 ## See also 54 55 [mean](mean.md), 56 [median](median.md), 57 [min](min.md), 58 [prod](prod.md), 59 [std](std.md), 60 [sum](sum.md), 61 [variance](variance.md)