Mathematica 9 is now available

Documentation / Mathematica / Built-in Functions / Lists and Matrices / List Operations /

Ordering

FilledSmallSquare Ordering[list] gives the positions in list at which each successive element of Sort[list] appears.

FilledSmallSquare Ordering[list, n] gives the positions in list at which the first n elements of Sort[list] appear.

FilledSmallSquare Ordering[list, -n] gives the positions of the last n elements of Sort[list].

FilledSmallSquare Ordering[list, n, p] uses Sort[list, p].

FilledSmallSquare Example: Ordering[c, a, b] LongRightArrow.

FilledSmallSquare In a numerical list Ordering[list, n] gives the positions of the n smallest elements. Ordering[list, -n] gives the positions of the n largest elements.

FilledSmallSquare If there are several smallest elements in list, Ordering[list, 1] will give only the position of the one that appears first.

FilledSmallSquare list[[Ordering[list]]] is the same as Sort[list].

FilledSmallSquare Ordering[list, seq] is equivalent to Take[Ordering[list], seq].

FilledSmallSquare Ordering[list, All, p] gives the position at which all elements of list appear in Sort[list, p].

FilledSmallSquare Ordering can be used on expressions with any head, not only List.

FilledSmallSquare See Section 1.8.11.

FilledSmallSquare See also: Max, Min, Position, OrderedQ, Median.

FilledSmallSquare New in Version 4.1.

Further Examples



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.