MathGroup Archive 1997

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

Search the Archive


  • To: mathgroup at
  • Subject: [mg8540] Sort[]
  • From: Raya Firsov-Khanin <raya at>
  • Date: Sat, 6 Sep 1997 23:16:09 -0400
  • Sender: owner-wri-mathgroup at


I need to Sort[] lists that contain symbols.

I've noticed the following strange feature of Sort[].
Take a simple list
myList = {b, -b}; Sort gives a result in canonical order


{-b,b}  or 

Sort[myList, Less]


Take now a simple list

myList1 = {-b, b}; Then, Sort gives the same correct result 



while Sort[] with Less argument gives incorrect result.

Sort[myList1, Less]

Can someone explain what is the problem and how to deal with it?

I also need to work with list where symbols are declared Positive
(or Negative) etc. For instance, declare c Negative:


Sort[{-c, c}] should give {c, -c}

How to Sort those lists? Is there a way to use Sort[]
or I have to write my own function.

            Raya Khanin
            University of Edinburgh

  • Prev by Date: conics and graphics
  • Next by Date: MatchQ
  • Previous by thread: Re: conics and graphics
  • Next by thread: Re: Sort[]