# Why do these commands give different answers?

I'm using v12

list = {{0, 2}, {9, 0}, {4, 2}, {4, 8}, {1, 5}, {10, 8}, {7, 4}, {7, 9}, {9, 7}, {10, 9}};

SortBy[list, Norm]

> {{0, 2}, {9, 0}, {4, 2}, {4, 8}, {1, 5}, {10, 8}, {7, 4}, {7, 9}, {9, 7}, {10, 9}}

SortBy[list, N@*Norm]

> {{0, 2}, {4, 2}, {1, 5}, {7, 4}, {4, 8}, {9, 0}, {7, 9}, {9, 7}, {10, 8}, {10, 9}}

• simpler input: lst = {{9, 0}, {4, 2}}? – kglr Oct 26 '19 at 0:37
• Sort >> Possible Issues: "Numeric expressions are sorted by structure as well as numerical value". For example, compare Sort@{9, 2 Sqrt[5]} and Sort@N@{9, 2 Sqrt[5]} (similarly Order @@ {9, 2 Sqrt[5]} versus Order@@N@{9, 2 Sqrt[5]}) – kglr Oct 26 '19 at 0:40

From the Scope section of SortBy

Sort a list of vectors by their norm:

vectors = {{1/2, 1/3}, {1/4, 1/5}, {1/6, 1/7}};
SortBy[vectors, Norm]
Norm /@ %


{{1/2, 1/3}, {1/4, 1/5}, {1/6, 1/7}}

{Sqrt[13]/6, Sqrt[41]/20, Sqrt[85]/42}

Their norms are sorted following canonical order, but not numerical order:

OrderedQ[%]
N[%%]


True

{0.600925, 0.320156, 0.219513}

Explicitly request sorting of norms by numerical order:

SortBy[vectors, Norm, NumericalOrder]
N[Norm /@ %]


{{1/6, 1/7}, {1/4, 1/5}, {1/2, 1/3}}

{0.219513, 0.320156, 0.600925}