Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Sort with -Infinity fails

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73862] Re: [mg73822] Sort with -Infinity fails
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 2 Mar 2007 06:32:04 -0500 (EST)
  • References: <200703011117.GAA28248@smc.vnet.net>

On 1 Mar 2007, at 12:17, Tom Aldenberg wrote:

> Dear MathGroup,
>
> Minus Infinity (-Infinity) is smaller than -8, but Sort does not 
> sort it as
> expected.
> Is there a Real minus Infinity?
>
>
> In[75]:=
>       -Infinity < -8
> Out[75]=
>       True
>
> In[76]:=
>       Sort[{-Infinity, -8, 5}]
> Out[76]=
>       {-8, 5, -=B0}
>
>
> Regards,
>
> Tom Aldenberg
>
> ______________________________________________________________________=

> ______
>
> DISCLAIMER:  http://www.rivm.nl/disclaimer.htm
>
>

Sort does not fail, but simply sorts things using Mathematica's 
canonical order in which numbers come before symbols.
You need to change the default sorting function to Less (or Greater):


Sort[{-Infinity, -8, 5}, Less]

{-Infinity, -8, 5}


Sort[{-Infinity, -8, 5}, Greater]


{5, -8, -Infinity}

Andrzej Kozlowski





  • Prev by Date: Re: Limit of Floor function
  • Next by Date: Re: Sort with -Infinity fails
  • Previous by thread: Sort with -Infinity fails
  • Next by thread: Re: Sort with -Infinity fails