Why is `+(::Number, UniformScaling)` deprecated?

It’s only true in mathematical abstractions with cancellation (that’s the definition). This is true of groups, which have additive inverses and associativity: left-add the inverse of the common element, then re-associate so the inverses cancel. This fails for floats because they are only approximately associative. If fails for I in your examples because you’re mixing different groups – scalars and matrices of various sizes. I behaves as a certain element in each of these groups, but identifying it with all of those element would transitively cause those elements all to be identified with each other. In other words, more important than cancellation (which only works in some algebraic structures), is that equality should be an equivalence relation: i.e. it should be reflexive and transitive. If we had ones(1, 1) == I and 1 == I then we’d be forced to have ones(1, 1) == 1; that may not seem so bad but you can also do eye(n) == I == 1 which is worse (although somewhat mathematically defensible), but which then implies that eye(n) == eye(m) for all n and m! That does not seems like a good situation since those are quite different matrices with different sizes.

1 Like

Thanks very much for your comments with more accurate definitions and clearer description of the issue!

If fails for I in your examples because you’re mixing different groups – scalars and matrices of various sizes

I think there is no mixing of different groups when I expect true for the 2nd and 4th output. True for the 2nd is derived from the 1st, and true for the 4th is derived from the 3rd. The 1st and 2nd are in the same group or vector space, so does the 3rd and 4th.

It is a good point if I expect true for “eye(3) == 1” from the 2nd and the 4th, then I am mixing different groups.

Anyway, I think you clearly understand my question in previous post. And thanks again.

julia> eye(3) + eye(3) == eye(3) + I
true

julia> eye(3) == I
false

julia> 1 + I == 1 + 1
true

julia> 1 == I
false

Yes, but if those were both true then we would be forced to have eye(3) == I == 1 and therefore eye(3) == 1 by transitivity. You could throw out transitivity in favor of cancellation, but I suspect that would not be a wise move.

2 Likes