min
Finds the smallest of all real numbers in a container or in a sequence.
Syntax
-
min(a, b)
-
a
is a real number -
b
is a real number
-
-
min(X)
-
X
is a vector, matrix, list, set, or structure
-
-
min(expr, var, a, b)
-
expr
is an expression in one variablevar
-
var
is the variable inexpr
-
a
is the lower bound -
b
is 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
v
is a real vector, thenmin(v)
is the smallest component ofv
. -
If
A
is a real matrix, thenmin(A)
is the smallest entry ofA
. -
If
L
is a non-empty list of real numbers, thenmin(L)
is the smallest of the elements ofL
. -
If
S
is a non-empty set of real numbers, thenmin(S)
is the smallest of the elements ofS
. -
If
S
is 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