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

solve now acknowledges dict=True for Relational args #17723

Merged
merged 8 commits into from Oct 21, 2019

Conversation

czgdp1807
Copy link
Member

@czgdp1807 czgdp1807 commented Oct 12, 2019

References to other Issues or PRs

Fixes #13534
Closes #13540

Brief description of what is fixed or changed

Other comments

Release Notes

  • solvers
    • solve now acknowledges dict=True for Relational args

AtharvaKhare and others added 4 commits October 26, 2017 10:33
Solve method will return a list of dictionaries for Relational args.
Currently, it only supports solution with `And`, `Or` only.
@sympy-bot
Copy link

sympy-bot commented Oct 12, 2019

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.5.

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
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234". See
https://github.com/blog/1506-closing-issues-via-pull-requests . Please also
write a comment on that issue linking back to this pull request once it is
open. -->
Fixes #13534
Closes #13540

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


#### 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
  * `solve` now acknowledges `dict=True` for Relational args
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@czgdp1807
Copy link
Member Author

ping @jksuom @asmeurer

@czgdp1807
Copy link
Member Author

What should solve([Eq(x, x), Eq(x, x+1)], x, dict=True) return? [] or [{}]?

@codecov
Copy link

codecov bot commented Oct 20, 2019

Codecov Report

Merging #17723 into master will increase coverage by 0.052%.
The diff coverage is 42.105%.

@@              Coverage Diff              @@
##            master    #17723       +/-   ##
=============================================
+ Coverage   74.689%   74.742%   +0.052%     
=============================================
  Files          634       633        -1     
  Lines       165811    166107      +296     
  Branches     38998     39077       +79     
=============================================
+ Hits        123844    124152      +308     
+ Misses       36480     36444       -36     
- Partials      5487      5511       +24

@czgdp1807
Copy link
Member Author

Someone, please help me with, https://travis-ci.org/sympy/sympy/jobs/600244489
I am unable to figure out why this is happening.

@czgdp1807
Copy link
Member Author

I am unable to figure out why this is happening.

Figured out. Thanks.

@czgdp1807
Copy link
Member Author

Since, all the tests are passing, the PR will be merged after 24 hours, if no critical objections are raised within the mentioned period. Thanks.

(x, y, z,), dict=True) == [{x: 1, y: -1, z: 1}, {x: 1, y: 1, z: 1},
{x: 2, y: -1, z: 1}, {x: 2, y: 1, z: 1},
{x: 3, y: -1, z: 1}, {x: 3, y: 1, z: 1}]
assert solve(Gt(x, 0), (x,), dict=True) == And(Lt(0, x), Lt(x, oo))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oscarbenjamin this last test is likely what is throwing the UserWarning (?)

if flags.get('dict', False):
solution = reduce_inequalities(f, symbols=symbols)
if isinstance(solution, Equality):
return [{solution.lhs: solution.rhs}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks bad, were are enumerating over things. We probably shouldn't return one of them...

Certainly no criticism intended to author of this. In particular I see other suspicious looking returns up above too! Line 973 and 975 for example...

@czgdp1807
Copy link
Member Author

@cbm755 Let me know if a follow up PR is needed for this.

@cbm755
Copy link
Contributor

cbm755 commented Nov 19, 2019

I'm not sure, still learning here myself.... I guess it may get reverted for 1.5.

But I like your idea of having dict=True do its thing when it can! But maybe its needs some revision...

@czgdp1807
Copy link
Member Author

Refer, #11661 (comment)

czgdp1807 added a commit to czgdp1807/sympy that referenced this pull request Nov 19, 2019
cbm755 added a commit that referenced this pull request Nov 19, 2019
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.

solve dict=True ignored
5 participants