MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Riddle with Ordering


On 19 Jun 2007, at 19:44, nazdrovje at gmail.com wrote:

> Just a gem I discovered with Ordering[ ].
>
> Anyone have an idea what
>
> SomeArrayWithUniqueReals // Ordering // Ordering
>
> does?
>
> I like this, especially the double use of Ordering. Answer tomorrow.
>

Iit's not much of a riddle for anyone who has been reading carefully  
this forum for a while as it has turned up more than once.  It gives  
you the permutation which will turn Sort[AnyList] into AnyList.   In  
other words:

Sort[AnyList][[Ordering[Ordering[AnyList]]]] == Anylist


This means, in particular, that if AnyPermuation is any permutation:

Ordering[Ordering[AnyPermuation]]==AnyPermutation

Moreover, AnyList does not have to be a list of reals, or even a list  
of numbers, and its elements need not be distinct.

Andrzej Kozlowski




  


  • Prev by Date: Re: MatrixPlot: frame ticks starting with 0?
  • Next by Date: Same Limit: OK in 5.2, fails in 6.0; Packages gone in 6.0 ???
  • Previous by thread: Re: Riddle with Ordering
  • Next by thread: Re: Riddle with Ordering