Mathematica 9 is now available

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

Further Examples: Ordering

Here is a list.

In[1]:=

This is the permutation that will put dd into sorted order.

In[2]:=

Out[2]=

Here is how to verify this.

In[3]:=

Out[3]=

You may only want to find the position of the maximum element.

In[4]:=

Out[4]=

Here is another way.

In[5]:=

Out[5]=

This gives the positions of the two largest elements in dd.

In[6]:=

Out[6]=

Here are the two largest elements.

In[7]:=

Out[7]=

This gives the ordering from largest to smallest.

In[8]:=

Out[8]=

This sorts the elements from largest to smallest.

In[9]:=

Out[9]=

Lists that are permutations of the numbers 1, 2, 3, , n can be composed using Part or [[]]. Here, for example, xx: 3 5 and yy: 5 1, so yyxx: 3 1.

In[10]:=

In[11]:=

In[12]:=

Out[12]=

Ordering gives the inverse of a permutation.

In[13]:=

Out[13]=

In[14]:=

Out[14]=

In[15]:=

Out[15]=

In[16]:=

See also the Further Examples for Sort.



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.