Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7679
| From | Christopher Young <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: SortBy won't order irrationals |
| Date | 2012-01-09 08:19 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jee7u7$cqf$1@smc.vnet.net> (permalink) |
| References | <201201060916.EAA26862@smc.vnet.net> <AE02F0F7-A101-45CD-B304-A19626EBAE43@mimuw.edu.pl> |
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
functions.
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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: SortBy won't order irrationals Christopher Young <cy56@comcast.net> - 2012-01-09 08:19 +0000
csiph-web