Opened 6 years ago
Closed 5 years ago
#20191 closed defect (fixed)
implement SymPy Piecewise equivalent
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.1 |
Component: | symbolics | Keywords: | |
Cc: | mforets | Merged in: | |
Authors: | Ralf Stephan | Reviewers: | Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | 1929337 (Commits, GitHub, GitLab) | Commit: | 1929337bc3d226c2d490ce9e6727bb0f52d408a6 |
Dependencies: | #23820 | Stopgaps: |
Description (last modified by )
This shows an equivalent to SymPy's Piecewise
is missing in Sage:
sage: _ = var('y, z') sage: (x^y - z).integrate(y) -y*z + x^y/log(x) sage: (x^y - z).integrate(y, algorithm="sympy") # see Trac #14694 Traceback (most recent call last): ... AttributeError: 'ExprCondPair' object has no attribute '_sage_' SymPy-1.0: >>> integrate(x**y-z,y) ⎛⎧ y for log(x) = 0⎞ ⎜⎪ ⎟ ⎜⎪ y ⎟ -y⋅z + ⎜⎨ x ⎟ ⎜⎪────── otherwise ⎟ ⎜⎪log(x) ⎟ ⎝⎩ ⎠
Piecewise
in SymPy is a held function of ExprCondPair
arguments. It would be a superset of our piecewise
. The name should not be confusable, a suggestion is if_then([(log(x)==0, y), (x^y/log(x), 1)])
.
When it is implemented a SymPy patch should be done for the _sage_
method.
EDIT: Maxima 5.38.1 returns a similar function for some integrals.
Change History (11)
comment:1 Changed 6 years ago by
- Description modified (diff)
comment:2 Changed 5 years ago by
- Description modified (diff)
- Milestone changed from sage-7.2 to sage-8.1
- Summary changed from implement ExprCondPair equivalent to implement SymPy Piecewise equivalent
comment:3 Changed 5 years ago by
- Description modified (diff)
comment:4 Changed 5 years ago by
- Branch set to u/rws/implement_sympy_piecewise_equivalent
comment:5 Changed 5 years ago by
- Commit set to 1929337bc3d226c2d490ce9e6727bb0f52d408a6
- Dependencies set to pynac-0.7.11
comment:6 Changed 5 years ago by
- Cc mforets added
comment:7 Changed 5 years ago by
- Dependencies changed from pynac-0.7.11 to #23820
comment:8 Changed 5 years ago by
- Status changed from new to needs_review
comment:9 Changed 5 years ago by
- Reviewers set to Travis Scrimshaw
Does this solve the issue in the ticket description? If so, I feel like we should add that as a doctest. If not, then you can set a positive review and post in a comment here which ticket will actually address it.
comment:10 Changed 5 years ago by
- Status changed from needs_review to positive_review
Right. #23923 depends on this.
comment:11 Changed 5 years ago by
- Branch changed from u/rws/implement_sympy_piecewise_equivalent to 1929337bc3d226c2d490ce9e6727bb0f52d408a6
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
20191: cases() function