1 |
|
2 |
|
3 | # Function min
|
4 |
|
5 | Compute the minimum value of a matrix or a list of values.
|
6 | In case of a multi dimensional array, the minimum of the flattened array
|
7 | will be calculated. When `dim` is provided, the minimum over the selected
|
8 | dimension will be calculated. Parameter `dim` is zero-based.
|
9 |
|
10 |
|
11 | ## Syntax
|
12 |
|
13 | ```js
|
14 | math.min(a, b, c, ...)
|
15 | math.min(A)
|
16 | math.min(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 minimum value
|
30 |
|
31 |
|
32 | ## Examples
|
33 |
|
34 | ```js
|
35 | math.min(2, 1, 4, 3) // returns 1
|
36 | math.min([2, 1, 4, 3]) // returns 1
|
37 |
|
38 | // minimum over a specified dimension (zero-based)
|
39 | math.min([[2, 5], [4, 3], [1, 7]], 0) // returns [1, 3]
|
40 | math.min([[2, 5], [4, 3], [1, 7]], 1) // returns [2, 3, 1]
|
41 |
|
42 | math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1
|
43 | math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5
|
44 | ```
|
45 |
|
46 |
|
47 | ## See also
|
48 |
|
49 | [mean](mean.md),
|
50 | [median](median.md),
|
51 | [max](max.md),
|
52 | [prod](prod.md),
|
53 | [std](std.md),
|
54 | [sum](sum.md),
|
55 | [variance](variance.md)
|