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
sqrt(x).is_negative returns False instead of None #18597
Conversation
✅ Hi, I am the SymPy bot (v149). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.6. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
This should be applied to |
Okay, will change that |
If we return None for nan/zoo than we have to also return None for a plain |
But from #14815(comment) i.e in orginal issue was to return |
It would be good to have a test for a symbol with |
@@ -530,6 +530,9 @@ def _eval_is_extended_positive(self): | |||
return log(self.base).is_imaginary | |||
|
|||
def _eval_is_extended_negative(self): | |||
if self.exp is S(1)/2: |
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.
is
works here because 1/2 is singletonized, but it's generally better to be explicit about that and use S.Half if you are using is
(otherwise use ==
).
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 should be able to generalize this.
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.
Okay I would change that and keep it correct next time. Should I commit this to same branch?
Fixes
sqrt(x).is_negative
to returnFalse
instead ofNone
References to other Issues or PRs
Fixes #14815
Brief description of what is fixed or changed
Before fixing:
After fixing:
Other comments
Release Notes
sqrt(x).is_negative
is False whenx
is real