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

Strange args for Piecewise #469

Open
rikardn opened this issue Jan 29, 2024 · 1 comment
Open

Strange args for Piecewise #469

rikardn opened this issue Jan 29, 2024 · 1 comment

Comments

@rikardn
Copy link
Contributor

rikardn commented Jan 29, 2024

A Piecewise does not give a tuple of tuple as args. This makes it incompatible with sympy.

expr = symengine.Piecewise((symengine.Symbol("x"), symengine.Symbol("y") > 0), (symengine.Symbol("k"), symengine.Symbol("w") > 0))

print(symengine.unicode(expr))
⎧x if 0 < y
⎨          
⎩k if 0 < w

expr.args
>>> (x, 0 < y, k, 0 < w)

import sympy

sympy.sympify(expr).args
>>> ((x, y > 0), (k, w > 0))
@rikardn
Copy link
Contributor Author

rikardn commented Feb 15, 2024

After pondering this I am now thinking that what symengine is doing is more consistent across all functions. sympy is actually returning a separate pair object which is quite different from any other args. I think we should keep the current behaviour for consistency. Any other thoughts?

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

No branches or pull requests

1 participant