Skip to content
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

Improvement in solveset for inequalities #19978

Merged
merged 1 commit into from Sep 1, 2020

Conversation

maurogaravello
Copy link
Contributor

@maurogaravello maurogaravello commented Aug 17, 2020

References to other Issues or PRs

Fixes #19977

Brief description of what is fixed or changed

The inequality atan(log(x)) > 0 in the domain Interval.open(0, oo) is not properly solved by solveset, which
returns ConditionSet instead of Interval.Open(1, oo). This is due mainly to line 643 (and line 666) of inequalities.py.
Indeed valid(start) in such situation returns NotImplementedError and so the execution of solve_univariate_inequality stops.
In such case start is equal to 0, which is outside the domain; so it is useless to add start to sol_sets.

Incidentally this change produces some failures in test_inequalities.py, due to periodicity issue.
Indeed in such cases, solve_univariate_inequality checks the periodicity (which is pi or 2pi) and at lines 513-514 defines a new domain accordingly. The new domain is left closed and right open.
So if one respects this choice, then we need to eliminate the rightmost point in the solution.

Other comments

Release Notes

  • solvers
    • improved functionality for solveset in case of inequalities

@sympy-bot
Copy link

sympy-bot commented Aug 17, 2020

Hi, I am the SymPy bot (v160). 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.7.

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.

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs

Fixes #19977 
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->


#### Brief description of what is fixed or changed

The inequality `atan(log(x)) > 0` in the domain `Interval.open(0, oo)` is not properly solved by `solveset`, which
returns `ConditionSet` instead of `Interval.Open(1, oo)`. This is due mainly to line 643 (and line 666) of `inequalities.py`.
Indeed `valid(start)` in such situation returns `NotImplementedError` and so the execution of `solve_univariate_inequality` stops.
In such case `start` is equal to `0`, which is outside the domain; so it is useless to add `start` to `sol_sets`.

Incidentally this change produces some failures in `test_inequalities.py`, due to periodicity issue.
Indeed in such cases, `solve_univariate_inequality` checks the periodicity (which is `pi` or `2pi`) and at lines 513-514 defines a new domain accordingly. The new domain is left closed and right open.
So if one respects this choice, then we need to eliminate the rightmost point in the solution.

#### Other comments


#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
- solvers
  - improved functionality for solveset in case of inequalities


<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@codecov
Copy link

codecov bot commented Aug 17, 2020

Codecov Report

Merging #19978 into master will decrease coverage by 16.261%.
The diff coverage is 100.000%.

@@              Coverage Diff               @@
##            master    #19978        +/-   ##
==============================================
- Coverage   75.832%   59.570%   -16.262%     
==============================================
  Files          669       669                
  Lines       173451    173476        +25     
  Branches     40903     40911         +8     
==============================================
- Hits        131532    103341     -28191     
- Misses       36196     64280     +28084     
- Partials      5723      5855       +132     

@oscarbenjamin
Copy link
Contributor

Looks good. Thanks!

@oscarbenjamin oscarbenjamin merged commit e975b8a into sympy:master Sep 1, 2020
@maurogaravello maurogaravello deleted the inequality branch September 1, 2020 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

solveset returns ConditionSet
4 participants