# Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# MaximalBy

MaximalBy[{e1,e2,},f]
returns a list of the for which the value of is maximal.

MaximalBy[{e1,e2,},f,n]
returns a list of the corresponding to the n largest .

MaximalBy[f]
represents an operator form of MaximalBy that can be applied to an expression.

## DetailsDetails

• Values of are compared using the same canonical order as in Sort.
• The maximal are returned in the order they appear in the input.
• In the case of MaximalBy[list,f,n], the are sorted in the order of decreasing , with those having the same value of being taken in the order they appear in list.
• MaximalBy[list,f, UpTo[n]] gives n elements, or as many as are available.
• MaximalBy[f][expr] is equivalent to MaximalBy[expr,f].

## ExamplesExamplesopen allclose all

### Basic Examples  (4)Basic Examples  (4)

Find the maximal element by last part:

 Out[1]=

All maximal elements are returned, in order of appearance:

 Out[1]=

Obtain the first three maximal elements:

 Out[1]=

Obtain the first 4 maximal elements, or as many as are available:

 Out[1]=