-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Description
<ₑ is normally used for sorting arguments.
sort!(v; lt=isless, ...) requires that only one of lt(x,y) and lt(y,x) can return true.
Here is an example where both return true.
using SymbolicUtils
using SymbolicUtils: <ₑ
@syms x
a = 28(x^14)
b = 44(x^7)
a <ₑ b # true
b <ₑ a # trueWe got strange results sometimes.
using SymbolicUtils
using SymbolicUtils: <ₑ, unsorted_arguments
@syms x
n = 4
expr = sum((n + 1 - i) * x^i for i in 1:n)
args = unsorted_arguments(expr)julia> sort(args, lt = <ₑ)
4-element Vector{Any}:
x^4
2(x^3)
4x
3(x^2)
julia> sort(reverse(args), lt = <ₑ)
4-element Vector{Any}:
x^4
3(x^2)
4x
2(x^3)Note that the two above are different.
Metadata
Metadata
Assignees
Labels
No labels