min
Finds the smallest of all real numbers in a container or in a sequence.
Syntax
-
min(a, b)-
ais a real number -
bis a real number
-
-
min(X)-
Xis a vector, matrix, list, set, or structure
-
-
min(expr, var, a, b)-
expris an expression in one variablevar -
varis the variable inexpr -
ais the lower bound -
bis the upper bound
-
Description
The smallest of two numbers
If a and b are real numbers, then min(a, b) is the smallest of them.
Finding the smallest number in a container
-
If
vis a real vector, thenmin(v)is the smallest component ofv. -
If
Ais a real matrix, thenmin(A)is the smallest entry ofA. -
If
Lis a non-empty list of real numbers, thenmin(L)is the smallest of the elements ofL. -
If
Sis a non-empty set of real numbers, thenmin(S)is the smallest of the elements ofS. -
If
Sis a structure containing real numbers, thenmin(S)is the smallest of the numbers inS.
Finding the smallest number in a sequence
min(expr, var, a, b) is the smallest value of expr as var takes all integer values from a to b, inclusively. expr must return a real value for every value of var in [a, b] ∩ ℤ. The number of elements in the sequence, b − a + 1, must be at least 1.
Examples
The smallest of two numbers
f ≔ x ↦ 5⋅min(x, 2)
custom function
Finding the smallest number in a container
min('(10/51, 49/256, 5/27, 6/29, 3/14, 24/121))
0.185185185185 (=5/27)
min(RandomVector(100))
0.00970940268598
min(RandomIntMatrix(100, 100, 1000000))
135
min(size(❨❨1, 2❩, ❨4, 1❩, ❨0, 1❩❩))
2
f ≔ n ↦ if(even(n), n/2, 3⋅n + 1);
n ≔ 27; L ≔ IteratedImages(f, n, 100); '(min(L), max(L))
23 9232
Finding the smallest number in a sequence
min(sin(k/2) + 5⋅cos(k/3) − sin(k/4), k, −10, 10)
−6.70556579756