sorts the elements of list into numerical order.
- NumericalSort[list] is equivalent to Sort[list,NumericalOrder].
- NumericalSort uses the same canonical order as Sort, except that it treats all numeric expressions, dates and Quantity objects by value, independent of their representation.
- NumericalSort can be used on expressions with any head, not only List.
Examplesopen allclose all
Basic Examples (2)
-∞ comes before any real-valued expression, and ∞ comes after any real-valued expression:
Sort arguments of any expression:
Sort associations by numerical value:
Sort expressions of the same head by numerical value:
Complex-value expressions are sorted first by the real part and then by the absolute value of the imaginary part:
Sort quantities having compatible units:
If incompatible units are found, compatible units are grouped together:
Properties & Relations (1)
NumericalSort uses NumericalOrder as ordering function:
Using Less as ordering function also sorts numeric expressions, but not necessarily other expressions:
Possible Issues (1)
NumericalSort will not guarantee a particular ordering for different representations of the same number:
The canonical order will always rearrange in a definite way:
Wolfram Research (2017), NumericalSort, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericalSort.html.
Wolfram Language. 2017. "NumericalSort." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NumericalSort.html.
Wolfram Language. (2017). NumericalSort. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumericalSort.html