I've found an issue about Sympy that I can't understand.
Why does this return false...
factor(81*q + 90) == 9*(9*q + 10)
... whilst this returns true?
factor(q**2-64) == (q+8)*(q-8)
When I type
factor(81*q + 90)
the output is exactly this expression
9*(9*q + 10)
So, why doesn't Sympy consider my first comparison is true?
SymPy automatically distributes
number*addition
, like9*(9*q + 10)
into81*q + 90
.factor
uses a trick to prevent this automatic simplification (basically,Mul(9, 9*q + 10, evaluate=False)
).There is an open issue to remove this automatic simplification, but it hasn't been implemented yet.