Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Strange behavior of Sort

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

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."

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


Or, if you like it more

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

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


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> To: mathgroup at
Subject: [mg12993] [mg12941] Strange behavior of Sort

>In Mathematica 3.0:
>li={1/Sqrt[2], 1, -Sqrt[2]};
>{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????