NumericalSort

NumericalSort[list]

sorts the elements of list into numerical order.

Details

Examples

open allclose all

Basic Examples  (2)

Sort by numerical value:

This may be different from the canonical expression order:

Groups of elements that can be compared with each other will typically be together in the result:

Scope  (7)

- 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:

Sort date objects:

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.

Text

Wolfram Research (2017), NumericalSort, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericalSort.html.

CMS

Wolfram Language. 2017. "NumericalSort." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NumericalSort.html.

APA

Wolfram Language. (2017). NumericalSort. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumericalSort.html

BibTeX

@misc{reference.wolfram_2024_numericalsort, author="Wolfram Research", title="{NumericalSort}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/NumericalSort.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_numericalsort, organization={Wolfram Research}, title={NumericalSort}, year={2017}, url={https://reference.wolfram.com/language/ref/NumericalSort.html}, note=[Accessed: 22-November-2024 ]}