Re: Riddle with Ordering
- To: mathgroup at smc.vnet.net
- Subject: [mg77947] Re: [mg77904] Riddle with Ordering
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 20 Jun 2007 05:34:59 -0400 (EDT)
- References: <200706191044.GAA07379@smc.vnet.net>
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
- References:
- Riddle with Ordering
- From: nazdrovje@gmail.com
- Riddle with Ordering