       RE: Sort with -Infinity fails

• To: mathgroup at smc.vnet.net
• Subject: [mg73867] RE: [mg73822] Sort with -Infinity fails
• From: "Tony Harker" <a.harker at ucl.ac.uk>
• Date: Fri, 2 Mar 2007 06:34:44 -0500 (EST)

```The problem is that Sort is not a numeric function -- but if you define your
own comparison function it can be:

In:=
l={2,-Infinity,-E,-1,0,1,E,Infinity,-2};
Sort[l]

Out=
{-2,-1,0,1,2,-\[ExponentialE],\[ExponentialE],-\$B!g(B,\$B!g(B}

In:=
Sort[l,#1<#2&]

Out=
{-\$B!g(B,-\[ExponentialE],-2,-1,0,1,2,\[ExponentialE],\$B!g(B}

In:=
Sort[l,Less]

Out=
{-\$B!g(B,-\[ExponentialE],-2,-1,0,1,2,\[ExponentialE],\$B!g(B}

Tony

Dr A.H. Harker
Department of Physics and Astronomy
University College London
Gower Street
London
WC1E 6BT

]->-----Original Message-----
]->From: Tom Aldenberg [mailto:Tom.Aldenberg at rivm.nl]
]->Sent: 01 March 2007 11:17
]->To: mathgroup at smc.vnet.net
]->Subject: [mg73822] Sort with -Infinity fails
]->
]->Dear MathGroup,
]->
]->Minus Infinity (-Infinity) is smaller than -8, but Sort does
]->not sort it as expected.
]->Is there a Real minus Infinity?
]->
]->
]->In:=
]->      -Infinity < -8
]->Out=
]->      True
]->
]->In:=
]->      Sort[{-Infinity, -8, 5}]
]->Out=
]->      {-8, 5, -\$B!g(B}
]->
]->
]->Regards,
]->
]->Tom Aldenberg
]->
]->_____________________________________________________________
]->_______________
]->
]->DISCLAIMER:  http://www.rivm.nl/disclaimer.htm
]->
]->
]->

```

• Prev by Date: Re: change filename automatically in Export Command
• Next by Date: Re: Beginner--Problem with FilledPlot
• Previous by thread: Re: NDSolve. Getting the final values
• Next by thread: Re: Sort with -Infinity fails