PositionSmallest
✖
PositionSmallest
gives the positions of the n smallest values in list as determined by orderfun.
Details

- PositionSmallest by default compares values by numerical magnitude, returning the list of positions of the smallest value or n smallest values.
- PositionSmallest[list] gives a single list for the smallest value.
- PositionSmallest[list,n] gives a list of n sublists for the n smallest values, or as many as are available if fewer than n.
- PositionSmallest expects all objects to be comparable with one another, based on the ordering function.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (6)Survey of the scope of standard use cases
Find positions of the two smallest values in an association:

https://wolfram.com/xid/0bnh6n42e6y4m-diccrh

PositionSmallest works with arbitrary numeric values:

https://wolfram.com/xid/0bnh6n42e6y4m-3dwb7v

PositionSmallest can work with orderings of non-numeric data:

https://wolfram.com/xid/0bnh6n42e6y4m-j9ubu2

PositionSmallest uses numeric ordering by default:

https://wolfram.com/xid/0bnh6n42e6y4m-ixmoen

Instead use canonical ordering:

https://wolfram.com/xid/0bnh6n42e6y4m-5skp60

PositionSmallest works on lists of Quantity expressions:

https://wolfram.com/xid/0bnh6n42e6y4m-uidkau


https://wolfram.com/xid/0bnh6n42e6y4m-6zv4dw

PositionSmallest works on lists of DateObject expressions:

https://wolfram.com/xid/0bnh6n42e6y4m-fdqisq


https://wolfram.com/xid/0bnh6n42e6y4m-ff2ija

Properties & Relations (4)Properties of the function, and connections to other functions
Find positions of the smallest elements in a random list:

https://wolfram.com/xid/0bnh6n42e6y4m-r2351n

Compare to results using Position and Min:

https://wolfram.com/xid/0bnh6n42e6y4m-x9scg3

PositionSmallest gives positions of all the smallest elements:

https://wolfram.com/xid/0bnh6n42e6y4m-9m9r0q

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

https://wolfram.com/xid/0bnh6n42e6y4m-edayxf

One must specify the count of minimal elements to get all positions corresponding to the smallest element using TakeSmallest:

https://wolfram.com/xid/0bnh6n42e6y4m-y3ptag

Find positions of the smallest elements in a random list:

https://wolfram.com/xid/0bnh6n42e6y4m-9cdsjz

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

https://wolfram.com/xid/0bnh6n42e6y4m-osokih

Find positions of the smallest elements in a random list:

https://wolfram.com/xid/0bnh6n42e6y4m-v7uwai

FindPeaks locates positions of all local minimal values:

https://wolfram.com/xid/0bnh6n42e6y4m-sfupkf

Remove all peak positions that do not correspond to the global minimum value:

https://wolfram.com/xid/0bnh6n42e6y4m-ra7zn7

Possible Issues (2)Common pitfalls and unexpected behavior
If fewer than the requested count of smallest values are present, PositionSmallest will give as many as are present:

https://wolfram.com/xid/0bnh6n42e6y4m-4cvnvp

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

https://wolfram.com/xid/0bnh6n42e6y4m-kng5d2


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