We deliver solutions for the AI eraâcombining symbolic computation, data-driven insights and deep technology expertise.
NumericalOrder[e1,e2]
gives 1 if e1<e2, -1 if e1>e2, 0 if e1 and e2 are numerically the same, and orders by type or using canonical order if e1 and e2 are not numerically comparable.
DetailsThese two numbers are not ordered:
These two are numerically the same:
This is not always the same as the canonical order of expressions:
Scope (6)Compare any two numeric expressions:
-∞ comes before any real-valued expression:
∞ comes after any real-valued expression:
Complex valued expressions are ordered first by the real part:
When the real part is numerically the same, they are ordered by the absolute value of the imaginary part:
Compare quantities of compatible units:
The comparison is performed by converting into a common unit:
DateObject expressions are ordered by AbsoluteTime:
Use NumericalOrder as ordering function:
Sort using the ordering permutation:
The resulting list is not ordered in canonical order, but it is ordered in numerical order:
Applications (1)Get the numerical ordering for a list:
Properties & Relations (8)For numeric expressions of different value, NumericalOrder compares them using those values:
Order always compares expressions structurally and may give different results:
Like Order, NumericalOrder is an antisymmetric function of expressions: NumericalOrder[e1,e2]==-NumericalOrder[e2,e1]:
Unlike Order, NumericalOrder[e1,e2] may return zero for non-identical e1, e2:
For comparable expressions e1, e2 a result NumericalOrder[e1,e2]0 implies e1-e2==0:
NumericalOrder compares inexact numbers using all available significant digits:
For machine-precision numbers, Less, Equal, Greater, etc. use 7 bits of tolerance:
Inexact numbers with any other precision are compared up to that precision:
NumericalOrder compares complex values by the real part and then by absolute value of the imaginary part:
This is consistent with Order for numbers:
Less, LessEqual and related functions cannot compare complex numbers:
Equivalent quantities have a NumericalOrder of 0:
The canonical order distinguishes between the two representations:
Use Equal to show that they are indeed equivalent quantities:
For non-numerical expressions e1, e2, NumericalOrder coincides with Order:
Possible Issues (1)Sorting with NumericalOrder will not guarantee a particular ordering for different representations of the same number:
This does not give the same result for a permutation of the list:
The canonical order will rearrange in a definite way:
A stricter order can be defined by using Order to resolve cases where NumericalOrder gives 0:
Wolfram Research (2017), NumericalOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericalOrder.html. TextWolfram Research (2017), NumericalOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericalOrder.html.
CMSWolfram Language. 2017. "NumericalOrder." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NumericalOrder.html.
APAWolfram Language. (2017). NumericalOrder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumericalOrder.html
BibTeX@misc{reference.wolfram_2025_numericalorder, author="Wolfram Research", title="{NumericalOrder}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/NumericalOrder.html}", note=[Accessed: 12-July-2025 ]}
BibLaTeX@online{reference.wolfram_2025_numericalorder, organization={Wolfram Research}, title={NumericalOrder}, year={2017}, url={https://reference.wolfram.com/language/ref/NumericalOrder.html}, note=[Accessed: 12-July-2025 ]}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4