You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling bool() on symbolic equalities is a longstanding pain point in our user interface. There are three possible return values: True, False, and "I don't know." For compatibility with python (IIRC) we make sure to always return either True or False... but then what happens to "I don't know"? It gets turned in to False! So you never really know whether or not your equation was provably false, or just too hard to decide.
Sage isn't smart enough to apply your assumptions to this equation, so it doesn't know, for example, that n isn't 1/2. It therefore cowardly refuses to simplify what might be a multi-valued square root to the single value that would make this equation true.
To work around the second problem, subtract the left-hand side of your equation from the right-hand side, and call canonicalize_radical() on the result. It should come out to zero.
@orlitzky: An equivalent comparison via ((x-y)^n - (-1)^n*(y-x)^n).is_zero() is not bound to always return True or False, and could tell us "Don't know" (say, in the form of an exception), but it still returns wrong False.
I don't think it would be too terrible to throw an exception in bool(). No one likes the existing behavior and I'm certainly not defending it; the main roadblock is how much work it would be to change it in a consistent way. A few people have started to work on it over the years but no one has made much progress, e.g.
Steps To Reproduce
var('x, y, n')
assume(n,'integer')
assume(n >= 0)
bool((x-y)^n==(-1)^n*(y-x)^n)
Expected Behavior
Returns True.
Actual Behavior
Returns False.
Additional Information
https://ask.sagemath.org/question/80970/how-to-determine-equality-of-symbolic-expressions/
Environment
Checklist
The text was updated successfully, but these errors were encountered: