You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know what version of SymPy you are using but I don't have a latex2sympy function on master. I guess that it is returning something unevaluated like
In [5]: e =Mul(Add(90, -1, evaluate=False), 2, evaluate=False)
In [6]: e
Out[6]:2⋅(-1+90)
In [7]: e.doit()
Out[7]:178
In [8]: e.func(*e.args)
Out[8]:-2+180
In [9]: e.func(*e.args, evaluate=False)
Out[9]:2⋅(-1+90)
The invariant that x==x.func(*x.args) does depend on whether or not x was created with evaluate=True or evaluate=False.
latex2sympy is a third party function which is adopted into sympy in recent versions as "parse_latex". It converts latex expression to sympy.
Your point is correct. Exact identiity should be "x==x.func(*x.args, evaluate=False)".
Thanks
"Every well-formed SymPy expression must either have empty args or satisfy expr == expr.func(*expr.args)."
However,
following returns false.
expr = r"(90-1)*2"
sym = latex2sympy(expr)
sym2 = sym.func(*sym.args)
print sym == sym2 // false
What is well-formed anyway?
The text was updated successfully, but these errors were encountered: