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
- References:
- Sort with -Infinity fails
- From: Tom Aldenberg <Tom.Aldenberg@rivm.nl>
- Sort with -Infinity fails