RankedMin
Details
- RankedMin yields a definite result if all its arguments are real numbers.
- RankedMin[{x1,…,xm},n] is often indicated using
or
. - RankedMin[{x1,…,xm},1] is equivalent to Min[{x1,…,xm}]. »
- RankedMin[{x1,…,xm},-1] is equivalent to Max[{x1,…,xm}].
- RankedMin[{x1,…,xm},m] is equivalent to Max[{x1,…,xm}]. »
- RankedMin[{x1,…,xm},n] is equivalent to Quantile[{x1,…,xm},n/m]. »
Examples
open all close allBasic Examples (4)
The second smallest of three numbers:
RankedMin[{12, 13, 11}, 2]The third smallest of four numbers:
RankedMin[{Pi, Sqrt[2], E, 3}, 3]The second smallest of a list of dates:
RandomDate[4]RankedMin[%, 2]Plot the second-largest function over a subset of the reals:
Plot[RankedMin[{(1/2), Cos[x], -(1/2)}, 2], {x, 0, 2π}]Scope (25)
Numerical Evaluation (7)
Evaluate the second smallest of three numbers:
RankedMin[{12.6555, 3.5265, 25.65}, 2]The fourth smallest—i.e. the largest—of four numbers:
RankedMin[{12, 13, 48.5, Pi}, 4]The second largest of five numbers:
RankedMin[{2.5, E, 12, 15, 485}, -2]The fourth largest of five numbers:
RankedMin[{2.5, E, 12, 15, 485}, -4]The fifth largest—i.e. the smallest—of five numbers:
RankedMin[{2.5, E, 12, 15, 485}, -5]N[RankedMin[{12, 24, 48.5, Pi}, -4], 50]N[RankedMin[{12, 52, E, Pi}, -4], 70]Evaluate efficiently at high precision:
N[RankedMin[{12, E, 45 / 3`100, Pi}, -4]]//TimingRankedMin[{E, 5568586, 48565 / 7`10000000, Pi + E}, -4];//TimingRankedMin of WeightedData ignores the weights:
wd = WeightedData[{1, 2, 3, 4}, {1, 2, 1, 3}];RankedMin[wd, 2]RankedMin[wd["InputData"], 2]dates = WolframLanguageData[All, "DateIntroduced"];DateHistogram[dates]RankedMin[dates, 125]Compute the ranked min of times:
RandomTime[10]//SortRankedMin[%, 4]List of times with different time zone specifications:
{TimeObject[{12}, TimeZone -> 0], TimeObject[{12}, TimeZone -> 2], TimeObject[{12}, TimeZone -> "Asia/Tokyo"]}RankedMin[%, 2]Specific Values (4)
RankedMax[{∞, 5, ∞, -∞}, 2]RankedMax[{∞, 5, ∞, -∞}, -1]PiecewiseExpand[RankedMin[ {x, x + 1, y}, 3], -2 < x < 2, 3 < y < 4]Solve equations and inequalities:
Reduce[{RankedMin[{Sin[x], Cos[x], Sec[x]}, 2] > 0, 0 < x < 5}, x, Reals]Find a value of
for which the RankedMin[{Sin[x],Cos[x],Exp[x]},2]1:
xval = x /. FindRoot[RankedMin[{Sin[x], Cos[x], Exp[x]}, 2] == 1, {x, 2}]Plot[RankedMin[{Sin[x], Cos[x], Exp[x]}, 2], {x, -5, 6}, Epilog -> Style[Point[{xval, RankedMin[{Sin[xval], Cos[xval], Exp[xval]}, 2]}], PointSize[Large], Red]]Plot[RankedMin[{Sin[x], Cos[x], Exp[x]}, 2], {x, -5, 6}, Epilog -> {PointSize[Large], Red, Point[{xval, RankedMin[{Sin[xval], Cos[xval], Exp[xval]}, 2]}]}]Visualization (3)
Plot RankedMin of several functions:
Plot[RankedMin[{Sin[x], Cot[x], Tan[x]}, 2], {x, 0, 2π}, PlotRange -> All]Plot RankedMin in three dimensions:
Plot3D[RankedMin[{x, y, x y}, 2], {x, -3, 3}, {y, -3, 3}, ColorFunction -> "BlueGreenYellow"]Plot RankedMin of three functions in three dimensions:
Plot3D[RankedMin[{Tan[x], Tan[y], Tan[x y]}, 2], {x, -3, 3}, {y, -3, 3}, ColorFunction -> "BlueGreenYellow"]Function Properties (8)
RankedMin is only defined for real-valued inputs:
RankedMin[{1, I, E}, 2]The range of RankedMin is real numbers:
FindInstance[Im[RankedMin[{x, y, z}, 2]] ≠ 0, {x, y, z}]Basic symbolic simplification is done automatically:
RankedMin[{x, y, z}, 1]RankedMin[{x, y, z}, 3]Multi-argument ranked RankedMin is generally not an analytic function:
FunctionAnalytic[RankedMin[ {1, x, x ^ 2}, 2], x]It will have singularities where the functions cross, but it will be continuous:
FunctionSingularities[RankedMin[ {1, x, x ^ 2}, 2], x]//Quiet//ReduceFunctionDiscontinuities[RankedMin[ {1, x, x ^ 2}, 2], x]//Quiet//Reduce
is neither nondecreasing nor nonincreasing:
FunctionMonotonicity[RankedMin[ {1, x, x ^ 2}, 2], x]FunctionInjective[RankedMin[ {1, x, x ^ 2}, 2], x]Plot[{RankedMin[ {1, x, x ^ 2}, 2], 1 / 2}, {x, -2, 2}]FunctionSurjective[RankedMin[ {1, x, x ^ 2}, 2], x]Plot[{RankedMin[ {1, x, x ^ 2}, 2], -1}, {x, -2, 2}]FunctionSign[RankedMin[ {1, x, x ^ 2}, 2], x]Integration (3)
Series expansion of the second-smallest function at the origin:
Series[RankedMin[{Exp[x], x ^ 2, Tanh[x]}, 2], {x, 0, 3}]Asymptotic expansion at Infinity:
Series[RankedMin[{1 / x, 1 / (x - 1), 1 / (x + 2)}, 3], {x, ∞, 3}]//FullSimplifyIntegrate expressions involving RankedMin:
Integrate[RankedMin[{x + 1, x, 1 + x^2}, 2], x]Integrate[Boole[RankedMin[{x + y, x - y, x y}, 2] < 2], {x, 0, 2}, {y, 0, 2}]Applications (8)
Plot the bivariate RankedMin functions:
Table[Plot3D[RankedMin[{x, y}, k], {x, -2, 2}, {y, -2, 2}, PlotLabel -> RankedMin[{x, y}, k]], {k, 2}]Plot the contours of bivariate and trivariate RankedMin functions:
Table[ContourPlot[RankedMin[{x, y}, k] == 0, {x, -2, 2}, {y, -2, 2}, PlotLabel -> RankedMin[{x, y}, k] == 0], {k, 2}]ParallelTable[ContourPlot3D[RankedMin[{x, y, z}, k] == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, PlotLabel -> RankedMin[{x, y, z}, k] == 0], {k, 3}]RankedMin[{y1,…,yn,x},k] as a function of x:
data = Append[Range[1, 5] / 6, x]Table[Plot[RankedMin[data, k], {x, 0, 1}, Filling -> Axis, PlotLabel -> k, PlotRange -> {0, 1}], {k, 6}]Compute the expectation of the second smallest (median) variable:
Expectation[RankedMin[{x, y, z}, 2], {x, y, z}ProductDistribution[{ExponentialDistribution[λ], 3}]]Alternatively, use OrderDistribution:
Mean[OrderDistribution[{ExponentialDistribution[λ], 3}, 2]]Compute the probability of the second smallest variable being less than 1:
Probability[RankedMin[{x, y, z}, 2] < 1, {x, y, z}ProductDistribution[{ExponentialDistribution[λ], 3}]]Plot[%, {λ, 0, 5}]Show that OrderDistribution is a special case of TransformedDistribution:
PDF[#, w]& /@ Table[OrderDistribution[{NormalDistribution[], 3}, k], {k, 3}]PDF[#, w]& /@ Table[TransformedDistribution[RankedMin[{x, y, z}, k], {x, y, z}ProductDistribution[{NormalDistribution[], 3}]], {k, 3}]FullSimplify[%% - %]Find the height of the third shortest child in a class:
heights = Quantity[{134, 143, 131, 140, 145, 136, 131, 136, 143, 136, 133, 145, 147,
150, 150, 146, 137, 143, 132, 142, 145, 136, 144, 135, 141}, "Centimeters"];ListPlot[heights, Filling -> Axis, AxesLabel -> Automatic]r = RankedMin[heights, 3]n = Length[heights];
ListPlot[{heights, {{0, r}, {n, r}}}, Filling -> {1 -> 0}, Joined -> {False, True}, AxesLabel -> Automatic]Find the second-shortest border of Germany:
data = CountryData["Germany", "BordersLengths"]RankedMin[Values[data], 2]Select[data, Last[#] == %&]Properties & Relations (6)
RankedMin[{x1,…,xm},1] is equivalent to Min[x1,…,xm]:
Table[RankedMin[Array[Subscript[x, #]&, {m}], 1] == Min[Array[Subscript[x, #]&, {m}]], {m, 4}]RankedMin[{x1,…,xm},m] is equivalent to Max[x1,…,xm]:
Table[RankedMin[Array[Subscript[x, #]&, {m}], m] == Max[Array[Subscript[x, #]&, {m}]], {m, 4}]RankedMin[{x1,…,xm},n] is equivalent to RankedMax[{x1,…,xm},m-n+1]:
With[{n = 2}, Table[RankedMin[Array[Subscript[x, #]&, {m}], n] == RankedMax[Array[Subscript[x, #]&, {m}], m - n + 1], {m, 2, 3}]]FullSimplify[PiecewiseExpand /@ %, _∈Reals]RankedMin[{x1,…,xm},n] is equivalent to Quantile[{x1,…,xm},n/m]:
data = RandomSample[Range[100], 10];Table[RankedMin[data, n] == Quantile[data, n / 10], {n, 10}]RankedMin[{x1,…,xm},n] is equivalent to Sort[{x1,…,xm}]〚n〛:
data = RandomSample[Range[100], 10];Table[RankedMin[data, n] == Sort[data][[n]], {n, 10}]The equivalent Piecewise function has disjoint piecewise case domains:
PiecewiseDomains[HoldPattern[Piecewise[cases_, default_]]] :=
Module[{dl = Last /@ cases}, Append[dl, Not[Or@@dl]]]PiecewiseExpand[RankedMin[{x, y}, 2]]doms = PiecewiseDomains[%]Algebraically prove the piecewise case domains are disjoint:
Table[Resolve[ForAll[t, Exists[{x, y}, And@@ineqs]]], {ineqs, Subsets[doms, {2}]}]Table[RegionPlot[Evaluate[doms[[i]]], {x, -2, 2}, {y, -2, 2}, PlotStyle -> Lighter[ColorData[1, i], 0.3]], {i, 2}]doms = PiecewiseDomains[PiecewiseExpand[RankedMin[{x, y, z}, 2]]]Algebraically prove the piecewise case domains are pairwise disjoint:
Table[Resolve[ForAll[t, Exists[{x, y}, And@@ineqs]]], {ineqs, Subsets[doms, {2}]}]Table[RegionPlot3D[Evaluate[doms[[i]]], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, PlotStyle -> Lighter[ColorData[1, i], 0.5], Lighting -> "Neutral", Mesh -> None, PlotPoints -> 35], {i, 3}]Neat Examples (2)
Two-dimensional sublevel sets:
Table[RegionPlot[RankedMin[{x, y}, 1] < t, {x, -2, 2}, {y, -2, 2}, PlotLabel -> RankedMin[{x, y}, 1] < t], {t, {-1, 0, 1}}]Table[RegionPlot[RankedMin[{x, y}, 2] < t, {x, -2, 2}, {y, -2, 2}, PlotLabel -> RankedMin[{x, y}, 2] < t], {t, {-1, 0, 1}}]Three-dimensional sublevel sets:
Table[RegionPlot3D[RankedMin[{x, y, z}, 1] < t, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, PlotLabel -> RankedMin[{x, y, z}, 1] < t], {t, {-1, 0, 1}}]Table[RegionPlot3D[RankedMin[{x, y, z}, 2] < t, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, PlotLabel -> RankedMin[{x, y, z}, 2] < t], {t, {-1, 0, 1}}]Table[RegionPlot3D[RankedMin[{x, y, z}, 3] < t, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, PlotLabel -> RankedMin[{x, y, z}, 3] < t], {t, {-1, 0, 1}}]Related Guides
Text
Wolfram Research (2010), RankedMin, Wolfram Language function, https://reference.wolfram.com/language/ref/RankedMin.html (updated 2024).
CMS
Wolfram Language. 2010. "RankedMin." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/RankedMin.html.
APA
Wolfram Language. (2010). RankedMin. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RankedMin.html
BibTeX
@misc{reference.wolfram_2026_rankedmin, author="Wolfram Research", title="{RankedMin}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/RankedMin.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_rankedmin, organization={Wolfram Research}, title={RankedMin}, year={2024}, url={https://reference.wolfram.com/language/ref/RankedMin.html}, note=[Accessed: 12-June-2026]}