MathGroup Archive 2007

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

Search the Archive

Re: Ordering function weird?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82678] Re: Ordering function weird?
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Sun, 28 Oct 2007 04:02:18 -0500 (EST)

On 10/27/07 at 5:59 AM, claus.haslauer at web.de (Claus) wrote:

>Hi, say I've got two sets of number, x and y, which I want to rank.
>See the example below. I totally expect and want the result of
>Ordering[x]. But I neiter understand nor expect the result of
>Ordering[y]. Both Sort[x] and Sort[y] are ok. Can anybody explain to
>me Ordering[y]? Thanks, Claus

>In[3]:= x = {1, 2, 3, 6, 10, 3, 4} y = {1, 2, 7, 8, 9, 1, 2}

>In[7]:= Ordering[x] Ordering[y]

>Out[7]= {1, 2, 3, 6, 7, 4, 5}

>Out[8]= {1, 6, 2, 7, 3, 4, 5}

I don't understand your confusion. Looking at y I see the
smallest value in position 1 with the same value in position 6.
Hence the first two elements of the output. Then the next
smallest values are in position 2 and 7. So, the first 4 items
should be {1,6,2,7}. The largest 3 values occur in order from
positions 3 to 5. So, the output should be {1,6,2,7,3,4,5} as is
the case. What were you expecting?
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Ordering function weird?
  • Next by Date: Re: Mathematica not considering an assumption
  • Previous by thread: Re: Ordering function weird?
  • Next by thread: Re: Ordering function weird?