RankedMax
✖
RankedMax

Details

- RankedMax yields a definite result if all its arguments are real numbers.
- If
is a list with the ordering
, then RankedMax[x,n] gives
and RankedMax[x,-n] gives
for
.
- RankedMax[{x1,…,xm},1] is equivalent to Max[{x1,…,xm}]. »
- RankedMax[{x1,…,xm},-1] is equivalent to Min[{x1,…,xm}].
- RankedMax[{x1,…,xm},m] is equivalent to Min[{x1,…,xm}]. »
- RankedMax[{x1,…,xm},n] is equivalent to Quantile[{x1,…,xm},(m-n+1)/m]. »
Examples
open allclose allBasic Examples (4)Summary of the most common use cases
The second largest of three numbers:

https://wolfram.com/xid/0d6ha369wb-e44vd9

The third largest of four numbers:

https://wolfram.com/xid/0d6ha369wb-7vzs

The second largest of a list of dates:

https://wolfram.com/xid/0d6ha369wb-t7ech


https://wolfram.com/xid/0d6ha369wb-ziof1v

Plot the second-largest function over a subset of the reals:

https://wolfram.com/xid/0d6ha369wb-p27zvr

Scope (25)Survey of the scope of standard use cases
Numerical Evaluation (7)
Evaluate the second largest of three numbers:

https://wolfram.com/xid/0d6ha369wb-l274ju

The fourth largest—i.e the smallest—of four numbers:

https://wolfram.com/xid/0d6ha369wb-wlv0g

The second smallest of five numbers:

https://wolfram.com/xid/0d6ha369wb-cksbl4

The fourth smallest of five numbers:

https://wolfram.com/xid/0d6ha369wb-f2rd3q

The fifth smallest—i.e. the largest—of five numbers:

https://wolfram.com/xid/0d6ha369wb-whe1w


https://wolfram.com/xid/0d6ha369wb-b0wt9


https://wolfram.com/xid/0d6ha369wb-bihkib

Evaluate efficiently at high precision:

https://wolfram.com/xid/0d6ha369wb-di5gcr


https://wolfram.com/xid/0d6ha369wb-bq2c6r

RankedMax of WeightedData ignores the weights:

https://wolfram.com/xid/0d6ha369wb-14z4uk

https://wolfram.com/xid/0d6ha369wb-g9a19g


https://wolfram.com/xid/0d6ha369wb-c37mpe


https://wolfram.com/xid/0d6ha369wb-b1smxx

https://wolfram.com/xid/0d6ha369wb-pa4nmn


https://wolfram.com/xid/0d6ha369wb-uok1il

Compute the ranked max of times:

https://wolfram.com/xid/0d6ha369wb-et9bla


https://wolfram.com/xid/0d6ha369wb-ztsexm

List of times with different time zone specifications:

https://wolfram.com/xid/0d6ha369wb-mrqghz


https://wolfram.com/xid/0d6ha369wb-1d7sk5

Specific Values (4)

https://wolfram.com/xid/0d6ha369wb-4ular1


https://wolfram.com/xid/0d6ha369wb-uy3sat


https://wolfram.com/xid/0d6ha369wb-ia2x93

Solve equations and inequalities:

https://wolfram.com/xid/0d6ha369wb-gu8t6m

Find a value of x for which RankedMax[{Sin[x],Cos[x],Exp[x]},2]1:

https://wolfram.com/xid/0d6ha369wb-f2hrld


https://wolfram.com/xid/0d6ha369wb-x9nwz

Visualization (3)
Plot RankedMax of several functions:

https://wolfram.com/xid/0d6ha369wb-kmyjc9

Plot RankedMax in three dimensions:

https://wolfram.com/xid/0d6ha369wb-liq06l

Plot RankedMax of three functions in three dimensions:

https://wolfram.com/xid/0d6ha369wb-i75zi3

Function Properties (8)
RankedMax is only defined for real-valued inputs:

https://wolfram.com/xid/0d6ha369wb-8tb797


The range of RankedMax is real numbers:

https://wolfram.com/xid/0d6ha369wb-llfj64

Basic symbolic simplification is done automatically:

https://wolfram.com/xid/0d6ha369wb-iui8mf


https://wolfram.com/xid/0d6ha369wb-nyfidp

Multi-argument ranked RankedMax is generally not an analytic function:

https://wolfram.com/xid/0d6ha369wb-s56ru7

It will have singularities where the functions cross, but it will be continuous:

https://wolfram.com/xid/0d6ha369wb-w0a3ik


https://wolfram.com/xid/0d6ha369wb-s6homn

is neither nondecreasing nor nonincreasing:

https://wolfram.com/xid/0d6ha369wb-uj55mq


https://wolfram.com/xid/0d6ha369wb-ltv3uh


https://wolfram.com/xid/0d6ha369wb-1h1w4m


https://wolfram.com/xid/0d6ha369wb-pdrmmw


https://wolfram.com/xid/0d6ha369wb-oq3rbb


https://wolfram.com/xid/0d6ha369wb-vu5bjv

Series and Integration (3)
Series expansion of the second-largest function at the origin:

https://wolfram.com/xid/0d6ha369wb-0eq3dy

Asymptotic expansion at Infinity:

https://wolfram.com/xid/0d6ha369wb-bxbl7i

Integrate expressions involving RankedMax:

https://wolfram.com/xid/0d6ha369wb-cmd7zz


https://wolfram.com/xid/0d6ha369wb-fbe3vo

Applications (7)Sample problems that can be solved with this function
Plot the bivariate RankedMax functions:

https://wolfram.com/xid/0d6ha369wb-eg9du3

Plot the contours of bivariate and trivariate RankedMax functions:

https://wolfram.com/xid/0d6ha369wb-g63pm1


https://wolfram.com/xid/0d6ha369wb-hcm3au

RankedMax[{y1,…,yn,x},k] as a function of x:

https://wolfram.com/xid/0d6ha369wb-b5w22n


https://wolfram.com/xid/0d6ha369wb-d9za4u

Compute the expectation of the second smallest (median) variable:

https://wolfram.com/xid/0d6ha369wb-kf0aiu

Alternatively, use OrderDistribution:

https://wolfram.com/xid/0d6ha369wb-brumw5

Compute the probability of the second smallest variable being less than 1:

https://wolfram.com/xid/0d6ha369wb-g7do2v


https://wolfram.com/xid/0d6ha369wb-8tv9u

Find the height of the fourth tallest child in a class:

https://wolfram.com/xid/0d6ha369wb-cevfij

https://wolfram.com/xid/0d6ha369wb-fllmtw


https://wolfram.com/xid/0d6ha369wb-celepo


https://wolfram.com/xid/0d6ha369wb-ji5c5c

Find the second-longest border of Germany:

https://wolfram.com/xid/0d6ha369wb-dqoq3j


https://wolfram.com/xid/0d6ha369wb-g4umc6


https://wolfram.com/xid/0d6ha369wb-5siaoq

Properties & Relations (6)Properties of the function, and connections to other functions
RankedMax[{x1,…,xm},1] is equivalent to Max[x1,…,xm]:

https://wolfram.com/xid/0d6ha369wb-cm0qu5

RankedMax[{x1,…,xm},m] is equivalent to Min[x1,…,xm]:

https://wolfram.com/xid/0d6ha369wb-cvpztt

RankedMax[{x1,…,xm},k] is equivalent to RankedMin[{x1,…,xm},m-k+1]:

https://wolfram.com/xid/0d6ha369wb-es9l1f


https://wolfram.com/xid/0d6ha369wb-bwkc34

RankedMax[{x1,…,xm},n] is equivalent to Quantile[{x1,…,xm},(m-n+1)/m]:

https://wolfram.com/xid/0d6ha369wb-gsg9xi

https://wolfram.com/xid/0d6ha369wb-cngmv2

RankedMax[{x1,…,xm},n] is equivalent to Sort[{x1,…,xm},Greater]〚n〛:

https://wolfram.com/xid/0d6ha369wb-bwedxh

https://wolfram.com/xid/0d6ha369wb-bvu2ma

The equivalent Piecewise function has disjoint piecewise case domains:

https://wolfram.com/xid/0d6ha369wb-dvez

https://wolfram.com/xid/0d6ha369wb-oxmda


https://wolfram.com/xid/0d6ha369wb-9pwvg

Algebraically prove the piecewise case domains are disjoint:

https://wolfram.com/xid/0d6ha369wb-ib5932


https://wolfram.com/xid/0d6ha369wb-hdqchj


https://wolfram.com/xid/0d6ha369wb-b6qgju

Algebraically prove the piecewise case domains are pairwise disjoint:

https://wolfram.com/xid/0d6ha369wb-cflsmo


https://wolfram.com/xid/0d6ha369wb-cbnj16

Neat Examples (2)Surprising or curious use cases
Two-dimensional sublevel sets:

https://wolfram.com/xid/0d6ha369wb-eb921p


https://wolfram.com/xid/0d6ha369wb-hby3vq

Three-dimensional sublevel sets:

https://wolfram.com/xid/0d6ha369wb-1syew


https://wolfram.com/xid/0d6ha369wb-ojmgo3


https://wolfram.com/xid/0d6ha369wb-e947ou

Wolfram Research (2010), RankedMax, Wolfram Language function, https://reference.wolfram.com/language/ref/RankedMax.html (updated 2024).
Text
Wolfram Research (2010), RankedMax, Wolfram Language function, https://reference.wolfram.com/language/ref/RankedMax.html (updated 2024).
Wolfram Research (2010), RankedMax, Wolfram Language function, https://reference.wolfram.com/language/ref/RankedMax.html (updated 2024).
CMS
Wolfram Language. 2010. "RankedMax." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/RankedMax.html.
Wolfram Language. 2010. "RankedMax." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/RankedMax.html.
APA
Wolfram Language. (2010). RankedMax. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RankedMax.html
Wolfram Language. (2010). RankedMax. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RankedMax.html
BibTeX
@misc{reference.wolfram_2025_rankedmax, author="Wolfram Research", title="{RankedMax}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/RankedMax.html}", note=[Accessed: 27-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_rankedmax, organization={Wolfram Research}, title={RankedMax}, year={2024}, url={https://reference.wolfram.com/language/ref/RankedMax.html}, note=[Accessed: 27-April-2025
]}