-
Notifications
You must be signed in to change notification settings - Fork 66
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
List of inconsistency with sympy #400
Comments
|
I seem to recall ambiguities when broadcasting, but I'm not sure, perhaps it could be implemented without too much work. |
Can you use |
Thanks @isuruf I confirmed import sympy as sym
a = sym.Symbol("a")
expr = sym.And(a < 1, 0 < a)
expr.subs(a, -1)
import symengine as sym
a = sym.Symbol("a")
expr = sym.And(a < 1, 0 < a)
expr.subs(a, -1)
|
#396 was another inconsistency along the lines of item 2. I closed that one after isuruf showed the syntax that worked. I wasn't sure how faithfully symengine is supposed to mirror the sympy API. |
I found several syntactic inconsistency with SymPy. Sorry I was bit lazy to write separate issues.
1. Missing ITE syntax
(In sympy)
It works.
(In symengine)
Alternative solution
Use
Piecewise
, e.g.can be translated into
however
looks more intuitive to me.
2. Lambdify with a single function
(In sympy)
It works
(In symengine)
Alternative solution
Call lamdify with
sym.lambdify([t, a, b], [f])
, but this looks bit cumbersome (and result is always a list).3. Evaluate lambda function with inhomogeneous-shape arguments
(In sympy)
(In symengine)
Alternative solution
No. We need to repeatedly call
lamb_f
which is heavy overhead with python (probably I just don't know another solution).4. Inconsistent logical operation
(In sympy)
It works (preferably we should be able to write
0 < a < 1
in sympy but this raisesTypeError: cannot determine truth value of Relational
, anyways this is not the issue for symengine).(In symengine)
Alternative solution
Interestingly, if we write
this omits the first condition, i.e.
a < 1
. This returns unexpected value whena
is negative value.This should be
False
. Likely it's a bug. It returns the same expression when I write(0 < a) and (a < 1)
.The text was updated successfully, but these errors were encountered: