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

implement SymPy Piecewise equivalent #20191

Closed
rwst opened this issue Mar 11, 2016 · 13 comments
Closed

implement SymPy Piecewise equivalent #20191

rwst opened this issue Mar 11, 2016 · 13 comments

Comments

@rwst
Copy link
Contributor

rwst commented Mar 11, 2016

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.

Depends on #23820

CC: @mforets

Component: symbolics

Author: Ralf Stephan

Branch/Commit: 1929337

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/20191

@rwst rwst added this to the sage-7.2 milestone Mar 11, 2016
@rwst

This comment has been minimized.

@rwst

This comment has been minimized.

@rwst rwst changed the title implement ExprCondPair equivalent implement SymPy Piecewise equivalent Aug 12, 2017
@rwst rwst modified the milestones: sage-7.2, sage-8.1 Aug 12, 2017
@rwst

This comment has been minimized.

@rwst
Copy link
Contributor Author

rwst commented Aug 19, 2017

@rwst
Copy link
Contributor Author

rwst commented Aug 19, 2017

Commit: 1929337

@rwst
Copy link
Contributor Author

rwst commented Aug 19, 2017

New commits:

192933720191: cases() function

@rwst
Copy link
Contributor Author

rwst commented Aug 19, 2017

Dependencies: pynac-0.7.11

@rwst
Copy link
Contributor Author

rwst commented Sep 10, 2017

Changed dependencies from pynac-0.7.11 to #23820

@rwst
Copy link
Contributor Author

rwst commented Sep 23, 2017

Author: Ralf Stephan

@tscrim
Copy link
Collaborator

tscrim commented Sep 24, 2017

comment:9

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.

@tscrim
Copy link
Collaborator

tscrim commented Sep 24, 2017

Reviewer: Travis Scrimshaw

@rwst
Copy link
Contributor Author

rwst commented Sep 25, 2017

comment:10

Right. #23923 depends on this.

@vbraun
Copy link
Member

vbraun commented Sep 26, 2017

Changed branch from u/rws/implement_sympy_piecewise_equivalent to 1929337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants