-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
raise value error for Eq(RootOf(), Symbol) #15923
Changes from 2 commits
018e005
f392871
b33e6da
905ac79
51b7865
54c8ec3
2568b6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
from __future__ import print_function, division | ||
|
||
from sympy.core import (S, Expr, Integer, Float, I, oo, Add, Lambda, | ||
symbols, sympify, Rational, Dummy) | ||
symbols, sympify, Rational, Dummy, Symbol) | ||
from sympy.core.cache import cacheit | ||
from sympy.core.function import AppliedUndef | ||
from sympy.functions.elementary.miscellaneous import root as _root | ||
|
@@ -970,6 +970,8 @@ def _eval_Eq(self, other): | |
# is_real value of the CRootOf instance. | ||
if type(self) == type(other): | ||
return sympify(self == other) | ||
if other.has(Symbol): | ||
return | ||
if not (other.is_number and not other.has(AppliedUndef)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are mutually exclusive so if it is a number it doesn't have AppliedUndef so this simplifies to It might make more sense to do if not other.is_number:
# it might be a number after simplification but it isn't right now
# but if it is known that it is not constant, then it can't be a
# RootOf value (hence False)
return other.is_constant But I would tend to just return the None and let the user decide if they want to attempt simplification; I know There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't change this online because you might want to test it locally before making this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand this. Surely we don't want to return True just because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right: |
||
return S.false | ||
if not other.is_finite: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case below would return False for
Eq(root, Integral(x, (x, 1, 10)))
but yours would return None. As was suggested, whichif
is sending back the False? It is the one making the mistake and should be fixed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my case also it is returning false -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to figure out the problem before deciding how to fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it is not doing so from this function because the first check is false and your check is true and would return None.