Skip to content

PositionLargest

Positions of all occurrences of the largest element of a numeric list.

$ wo 'PositionLargest[{3, 1, 4, 1, 5}]'
{5}

Every occurrence of the maximum is reported.

$ wo 'PositionLargest[{1, 3, 2, 3}]'
{2, 4}

A second argument asks for the n largest values, each as its own sublist of positions.

$ wo 'PositionLargest[{1, 5, 3, 5, 2}, 2]'
{{4, 2}, {3}}