Skip to content

Min ​

The smallest of its arguments.

✓ checked against that system · ! checked, with disagreements (hover a chip)FungrimMinFungrim entry27766c540931737f2b75231e805c7ada7fb1Wolfram LanguageMin!SageMathenumeratio_min($*,)SymPyenumeratio_min($*,)Juliaenumeratio_min($*,)
Min(a, b, …)the smallest of two or more values.
Min(list)the smallest value in a list.
Min()the identity element +∞+\infty, for a call with no arguments at all.
Min(finset)the smallest member of a Finset.
Typed signatures
TypePackageApplies
(value+) -> numberanalyticreplaces compute-enginealways
(value+) -> numbercompute-enginealways
(any*) -> anycombinatoricsreplaces analyticalways
(any*) -> anystructuresreplaces combinatoricsalways

Domain: Arithmetic

Details
  • The smallest of its arguments, or of a single list argument.
  • Multiple arguments -- lists included -- are flattened into one pool rather than compared pairwise or threaded element-wise. See Max.
  • Commutative and associative: order and grouping don't matter.
  • min⁡(a,b)+max⁡(a,b)=a+b\min(a,b) + \max(a,b) = a + b for any two values. See Max.
  • Infinities participate directly in the comparison.
  • With no arguments at all, returns the identity element +∞+\infty.
  • Takes a Finset too: its smallest member, and NaN for the empty one, as for an empty list.

Examples

1 more kept as data, checked against the oracles
Basic #
live ↗
Inmin⁡(3,1,4,1,5)\min(3, 1, 4, 1, 5)Out11

Also accepts a single list argument

live ↗
Inmin⁡([3,1,4])\min(\bigl\lbrack3, 1, 4\bigr\rbrack)Out11
live ↗
Inmin⁡(−1,−5)\min(-1, -5)Out−5-5

A single argument is returned unchanged

live ↗
Inmin⁡(3)\min(3)Out33
live ↗
Inmin⁡(9,2)\min(9, 2)Out22
live ↗
Inmin⁡([4,1,7,2])\min(\bigl\lbrack4, 1, 7, 2\bigr\rbrack)Out11
live ↗
Inmin⁡(5.56,−4.8,7.3)\min(5.56, -4.8, 7.3)Out−4.8-4.8
Scope #

Nested lists are flattened into the pool

live ↗
Inmin⁡(2,3,[[12,−1],[−53,12]])\min(2, 3, \bigl\lbrack\bigl\lbrack\frac{1}{2}, -1\bigr\rbrack, \bigl\lbrack-\frac{5}{3}, \frac{1}{2}\bigr\rbrack\bigr\rbrack)Out−53-\frac{5}{3}

Exact numbers are compared numerically

live ↗
Inmin⁡(2,32)\min(\sqrt{2}, \frac{3}{2})Out2\sqrt{2}

The numeric arguments collapse to their minimum; symbolic ones stay

live ↗
Inmin⁡(3,x,5)\min(3, x, 5)Outmin⁡(3,x)\min(3, x)

Compares exact constants numerically: min⁡(e,π,5)=e\min(e, \pi, 5) = e

live ↗
Inmin⁡([e,π,5])\min(\bigl\lbrack e, π, 5\bigr\rbrack)Outee

The min of two Intervals is the interval of possible minima, [−3,3][-3, 3]

live ↗
Inmin⁡(Interval(1,3),Interval(−3,5))\min(\mathrm{Interval}(1, 3), \mathrm{Interval}(-3, 5))OutInterval(−3,3)\mathrm{Interval}(-3, 3)

A Finset has a smallest member: the subset {1,3,4}\{1,3,4\} of {1,…,6}\{1,\dots,6\}

live ↗
Inmin⁡(Finset⁡(Tuple⁡(6,[1,3,4])))\min(\operatorname{Finset}(\operatorname{Tuple}(6,\bigl\lbrack1, 3, 4\bigr\rbrack)))Out11
Applications #

The day's low from the same hourly readings. See Max

live ↗
Inmin⁡(68,72,65,80,74)\min(68, 72, 65, 80, 74)Out6565
Properties #

Commutative: order doesn't matter

live ↗
Inmin⁡(3,7)=min⁡(7,3)\min(3, 7)=\min(7, 3)OutTrue\mathrm{True}

min⁡(a,b)+max⁡(a,b)=a+b\min(a,b) + \max(a,b) = a + b. See Max

live ↗
Inmin⁡(4,9)+max⁡(4,9)=4+9\min(4, 9)+\max(4, 9)=4+9OutTrue\mathrm{True}

Idempotent: min⁡(x,x)=x\min(x, x) = x

live ↗
Inmin⁡(x,x)\min(x, x)Outxx
Possible issues #

Infinities participate directly in the comparison rather than being filtered out

live ↗
Inmin⁡(−∞,3)\min(-∞, 3)Out−∞-∞

Multiple arguments -- lists included -- are flattened into one pool rather than compared list-by-list. See Max

live ↗
Inmin⁡([3,1],0)\min(\bigl\lbrack3, 1\bigr\rbrack, 0)Out00

With no arguments it returns the identity element +∞+\infty (Max, whose identity is −∞-\infty, still returns NaN)

live ↗
Inmin⁡()\min()Out∞∞

The min of an empty list is NaN

live ↗
Inmin⁡([])\min(\bigl\lbrack\bigr\rbrack)OutNaN⁡\operatorname{NaN}

ComplexInfinity is unordered, so Min cannot compare it: the call stays unevaluated, as in Wolfram

live ↗
Inmin⁡(∞~,1)\min(\tilde∞, 1)Outmin⁡(1,∞~)\min(1, \tilde∞)

The empty Finset answers as an empty list does: NaN

live ↗
Inmin⁡(Finset⁡((3,[])))\min(\operatorname{Finset}((3,\bigl\lbrack\bigr\rbrack)))OutNaN⁡\operatorname{NaN}
About
Examples24
Checked againstWolfram Language 21 agree3 differSageMath 18 agree1 unevaluated4 errorSymPy 20 agree3 differ1 errormathlib4 10 agree7 errorJulia 16 agree4 errorRust 5 agree1 error
CrosswalkFungrimFungrim entry ×6Wolfram LanguageSageMathSymPyJuliaRust

Implementation

mappedmathlib4packages/oracle/src/mappings.ts

The smallest of the arguments as exact rationals. Several arguments are the pool; a lone argument is a list of numbers. The empty pool (ours is NaN, or +∞ with no arguments) and a nested list (ours flattens it) fail to elaborate rather than defaulting.

mappedmathlib4packages/oracle/src/mappings.ts

A single list of numbers; a lone number fails to elaborate.

mappedwolframpackages/oracle/src/mappings.ts

Same flattening as Max.

mappedsympypackages/oracle/src/mappings.ts

Same flattening as Max.

mappedsagepackages/oracle/src/mappings.ts

Same flattening as Max.

mappedjuliapackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts

Two operands.

See also: Max, Clamp