MathGroup Archive 2012

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

Search the Archive

Re: SortBy won't order irrationals

  • To: mathgroup at
  • Subject: [mg124102] Re: [mg124028] SortBy won't order irrationals
  • From: Christopher Young <cy56 at>
  • Date: Mon, 9 Jan 2012 03:16:07 -0500 (EST)
  • Delivered-to:
  • References: <> <>

OK, but that's not the behavior I'd expect, and it's something that has 
to be watched out for constantly. For example, if we use SortBy, I think 
that after all the functions have been applied to the list, we're stuck 
with this sorting  by complexity of expression unless we remember to 
apply N to every element of the list together with each of our other 

On Jan 6, 2012, at 5:46 PM, Andrzej Kozlowski wrote:

> Numeric symbols like Sqrt[2],Pi,E  etc.  etc are not sorted by their 
value but in the same way as all other symbols. Compare:
> Sort[{Pi, 4, Sqrt[2], 2, 3*E}]
> {2, 4, Sqrt[2], 3*E, Pi}
> with
> Sort[{Pi, 4, Sqrt[2], 2, 3*E}, Less]
> {Sqrt[2], 2, Pi, 4, 3*E}
> Note also that you can use Sort with a custom ordering function.
> Andrzej Kozlowski

  • Prev by Date: Re: more plotting peculiarities
  • Next by Date: Re: Re: find data
  • Previous by thread: Re: SortBy won't order irrationals
  • Next by thread: Re: SortBy won't order irrationals