Order[expr1,expr2]
gives 1 if expr1 is before expr2 in canonical order, and -1 if expr1 is after expr2 in canonical order. It gives 0 if expr1 is identical to expr2.
Order
Order[expr1,expr2]
gives 1 if expr1 is before expr2 in canonical order, and -1 if expr1 is after expr2 in canonical order. It gives 0 if expr1 is identical to expr2.
Examples
open all close allBasic Examples (1)
Scope (3)
Expressions are ordered by their structure, which may differ from their numerical values:
Order[2, Sqrt[2]]Numbers are generally ordered by their values:
Order[2, N@Sqrt[2]]Expressions can be equal but not identical:
Order[1 / 2, .5]Use Unevaluated to compare expressions without allowing them to change:
Order[Unevaluated[x + 1], Unevaluated[1 + x]]Without the wrapper, both expressions will evaluate to the same expression:
Order[x + 1, 1 + x]Applications (1)
Properties & Relations (4)
Order is an antisymmetric function of expressions: Order[e1,e2]==-Order[e2,e1]:
e1 = Sqrt[2] + 5;
e2 = E + Pi;NumericalOrder[e1, e2]NumericalOrder[e2, e1]Order is the default ordering function used by Sort:
list = {1 / 2, π, Sqrt[2], "hello", (x^3/3) + C[1]};
Sort[list] === Sort[list, Order]Order is the default ordering function used by OrderedQ:
data = {1, I Sqrt[2], RGBColor[1, 0, 0], "word", {a, α, ℵ}};OrderedQ[data] == OrderedQ[data, Order]Use NumericalOrder to prefer comparing numerical expressions by value rather than structure:
NumericalOrder[6, Pi]NumericalOrder[6, N[Pi]]Order always compares expressions structurally and may give different results:
Order[6, Pi]Possible Issues (1)
Order operates structurally, not by numerical value:
Order[6, Pi]Order[6, N[Pi]]Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), Order, Wolfram Language function, https://reference.wolfram.com/language/ref/Order.html.
CMS
Wolfram Language. 1988. "Order." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Order.html.
APA
Wolfram Language. (1988). Order. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Order.html
BibTeX
@misc{reference.wolfram_2026_order, author="Wolfram Research", title="{Order}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Order.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_order, organization={Wolfram Research}, title={Order}, year={1988}, url={https://reference.wolfram.com/language/ref/Order.html}, note=[Accessed: 12-June-2026]}