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
solveset_real need to check symbol in piecewise-condition.Expression with multiple abs ,having Piecewise solution as 0 #10550
Open
Shekharrajak
wants to merge
22
commits into
sympy:master
Choose a base branch
from
Shekharrajak:10534_merge_10122
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a3c1230
returning S.Zero
Shekharrajak d9a7e3f
minor changes
Shekharrajak 2e0818c
checking for each piece result that is included into res
Shekharrajak 0fbf329
syntax error fixed
Shekharrajak eeabc10
fixing whitespace error
Shekharrajak de834a9
need to check condition symbol and expr symbols
Shekharrajak dc7eb09
first check symbol then check f.expand().is_zero
Shekharrajak 8f1562e
handling piecewise that doesnt contain any symbol
Shekharrajak f10f965
fixing whitespace error
Shekharrajak 00da7d9
fixing testcase error
Shekharrajak 4163f15
whitespace error for comment fixed
Shekharrajak 91e994b
Merge branch '10122_solveset_multiple_abs' into 10534_merge_10122
Shekharrajak fe4351e
using my both PR solving 10122 and 10534
Shekharrajak 3d82e70
issue8692 test works and fixing whitespace error
Shekharrajak f3a6919
minor changes
Shekharrajak 4a04043
shifting piecewise solve and solveset test cases to right place
Shekharrajak 7106f59
global var expr_cond
Shekharrajak b22efc1
conflict checked
Shekharrajak 59f7332
Merge branch 'master'
Shekharrajak ce18a6d
Merge branch 'master'
Shekharrajak f0abf63
updating branch and better patch
Shekharrajak 79bd2c2
shifted solveset testcase from piecewise
Shekharrajak File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -487,9 +487,27 @@ def solveset_real(f, symbol): | |
elif f.is_Piecewise: | ||
result = EmptySet() | ||
expr_set_pairs = f.as_expr_set_pairs() | ||
for (expr, in_set) in expr_set_pairs: | ||
solns = solveset_real(expr, symbol).intersect(in_set) | ||
result = result + solns | ||
expr_cond = {} | ||
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. just write |
||
sym_interval ={} | ||
for other_n, (expr_tmp, cond) in enumerate(f.args): | ||
expr_cond[expr_tmp] = cond | ||
for (expr, in_set_symbol) in expr_set_pairs: | ||
solns_tmp = solveset_real(expr, symbol) | ||
# by default symbol interval. many times cond symbols are expr symbols | ||
for sym in expr.atoms(Symbol): | ||
if expr_cond[expr] != True: | ||
cond_symbol_set = expr_cond[expr].atoms(Symbol) | ||
for cond_symbol in cond_symbol_set: | ||
if sym == cond_symbol: | ||
sym_interval[sym] = in_set_symbol | ||
elif sym != cond_symbol: | ||
sym_interval[sym] = (S.Reals) | ||
if not expr.has(Symbol): | ||
solns = solns_tmp.intersect(in_set_symbol) | ||
result = result + solns | ||
else: | ||
solns = solns_tmp.intersect(sym_interval[symbol]) | ||
result = result + solns | ||
else: | ||
lhs, rhs_s = invert_real(f, 0, symbol) | ||
if lhs == symbol: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This should be in the solveset test suite; you aren't testing Piecewise, you are testing how solveset handles 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.
I found test case for
solve
just above so copied the same cases for solveset to check it is working correctly or not.I have shifted the both testcases.