# PositionLargest

PositionLargest[list]

gives the positions of the numerically largest value in list.

PositionLargest[list,n]

gives the positions of the first n largest values.

PositionLargest[list,n,orderfun]

gives the positions of the n largest values in list as determined by orderfun.

# Details

• PositionLargest by default compares values by numerical magnitude, returning the list of positions of the largest value or n largest values.
• PositionLargest[list] gives a single list for the largest value.
• PositionLargest[list,n] gives a list of n sublists for the n largest values, or as many as are available if fewer than n.
• PositionLargest expects all objects to be comparable with one another, based on the ordering function.

# Examples

open allclose all

## Basic Examples(2)

Find positions of the largest value in a list:

Get lists of positions for the three largest values:

## Scope(6)

Find positions of the two largest values in an association:

PositionLargest works with arbitrary numeric values:

PositionLargest can work with orderings of non-numeric data:

PositionLargest uses numeric ordering by default:

PositionLargest works on lists of Quantity expressions:

PositionLargest works on lists of DateObject expressions:

## Properties & Relations(4)

Find positions of the largest elements in a random list:

Compare to results using Position and Max:

PositionLargest gives positions of all the largest elements:

TakeLargest will only give as many element positions as are requested:

One must specify the count of maximal elements to get all positions corresponding to the largest element using TakeLargest:

Find positions of the largest elements in a random list:

One can use Ordering once the number of largest elements is known:

Find positions of the largest elements in a random list:

FindPeaks locates positions of all local maximal values:

When you remove all peak positions that do not correspond to the global maximum value, you lose positions if there happen to be consecutive peaks:

## Possible Issues(2)

If fewer than the requested count of largest values are present, PositionLargest will give as many as are present:

If the elements are not comparable, PositionLargest will not evaluate:

Wolfram Research (2022), PositionLargest, Wolfram Language function, https://reference.wolfram.com/language/ref/PositionLargest.html.

#### Text

Wolfram Research (2022), PositionLargest, Wolfram Language function, https://reference.wolfram.com/language/ref/PositionLargest.html.

#### CMS

Wolfram Language. 2022. "PositionLargest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PositionLargest.html.

#### APA

Wolfram Language. (2022). PositionLargest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PositionLargest.html

#### BibTeX

@misc{reference.wolfram_2024_positionlargest, author="Wolfram Research", title="{PositionLargest}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/PositionLargest.html}", note=[Accessed: 21-July-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_positionlargest, organization={Wolfram Research}, title={PositionLargest}, year={2022}, url={https://reference.wolfram.com/language/ref/PositionLargest.html}, note=[Accessed: 21-July-2024 ]}