Algosim documentation: min

min

Finds the smallest of all real numbers in a container or in a sequence.

Syntax

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

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

See also