Hello there!
I encountered the weirdest behavior of the unique()
function when throwing symbols at it:
using Symbolics
@variables a b
unique([-(a+1), -1.0(a+1)]) # 1-element Vector{Num}: -1 - a
unique([-a-b, -1(a+b)]) # 1-element Vector{Num}: -a - b
unique([2a+2b, 2.0(a+b)]) # 1-element Vector{Num}: 2a + 2b
unique([-(a+b), -1.0(a+b)]) # 2-element Vector{Num}: -a - b -a - b
isequal(-(a+b), -1.0(a+b)) # true
unique()
seems to work as expected for linear manipulations involving Int
and positive Float
, but not negative Float
.
According to the unique()
documentation it is supposed to behave like isequal()
, but this is clearly not the case here. I tried to look under the hood of unique()
to figure out the problem, but I don’t understand anything, still too much of a noob it seems…
Please let me know whether or not this is a bug and if I can do anything to open a bug report or so (never done that).
Cheers,
Johannes
P.S.: Using Julia 1.7 and Symbolics 4.3