MathGroup Archive 1998

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

Search the Archive

Re: Strange behavior of Sort

  • To: mathgroup at smc.vnet.net
  • Subject: [mg12993] Re: [mg12941] Strange behavior of Sort
  • From: "Jrgen Tischer" <jtischer at col2.telecom.com.co>
  • Date: Sun, 28 Jun 1998 02:52:15 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Edward,
how to you know? In doubt have a look at the Book, p. 991, A.3.9
Ordering of Expressions. There you find: "...Expressions are usually ordered by
comparing their parts in a depth first manner. Shorter expressions
come first."
Now

In[1]:= FullForm[{1/Sqrt[2], 1, -Sqrt[2]}]

Out[1]//FullForm=
List[Power[2,Rational[-1,2]],1,Times[-1,Power[2,Rational[1,2]]]]

Or, if you like it more

In[2]:= Depth/@{1/Sqrt[2], 1, -Sqrt[2]}

Out[2]= {2,1,3}

Jrgen

PS. Wolfram calls this ordering a canonical order, that means you can't
complain. It's their choice.


-----Original Message-----
From: Edward Neuman <edneuman at siu.edu> To: mathgroup at smc.vnet.net
Subject: [mg12993] [mg12941] Strange behavior of Sort


>In Mathematica 3.0:
>
>In[5]:=
>li={1/Sqrt[2], 1, -Sqrt[2]};
>
>In[7]:=
>Sort[li]//InputForm
>
>Out[7]//InputForm=
>{1, 1/Sqrt[2], -Sqrt[2]}
>
>Sort doesn't work properly on this list.
>
>Edward Neuman
>



  • Prev by Date: Re: Re: Re: FFT
  • Next by Date: Re: Find Max of "Concave" List
  • Previous by thread: Re: Re: Strange behavior of Sort
  • Next by thread: Trigonometric equation????