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 1999

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

Search the Archive

Re: Sort

  • To: mathgroup at
  • Subject: [mg19172] Re: Sort
  • From: Jens-Peer Kuska <kuska at>
  • Date: Tue, 10 Aug 1999 02:52:38 -0400
  • Organization: Universitaet Leipzig
  • References: <7odl77$>
  • Sender: owner-wri-mathgroup at

Hermann Meier wrote:
> Sort is not reliable. Try the following (Mathematica Version 4):
> In[1]:=
> Sort[{0, -Sqrt[2], 5}]

Hi Hermann,

thats nonsense. If you cant only sort the same kind of things.
There is no rule how to sort a train, a airplane and a toaster.
In you example you try to sort integers and symbolic expressions
like Sqrt[5]. Sort[] work as expected and create the "normal order" of
expressions i. e.
  numbers first, variables, functions ..

If you like to sort a list of numbers with some symbolic expressions
like Sqrt[2], E, Pi .. you can simply use the second sort argument and

Sort[{0, -Sqrt[2], 5}, N[#1] < N[#2] &]

will work as you expect.

Hope that helps

  • Prev by Date: Memory bloat -- what have I done?
  • Next by Date: Re: Sort
  • Previous by thread: RE: Sort
  • Next by thread: Re: Sort