-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Derivative.expr must be parenthesized when printed #18349
Comments
I don't think so because when you replace f(x) and g(x) with some expression then both They just look same in this case but they are not same. |
I can't reproduce this issue in
And that's why this is an issue! |
The problem is the latex printer (isympy uses the pretty printer): In [58]: d1 = Derivative(f(x)*g(x), x)
In [59]: d2 = Derivative(f(x), x) * g(x)
In [60]: d1
Out[60]:
d
──(f(x)⋅g(x))
dx
In [61]: d2
Out[61]:
d
──(f(x))⋅g(x)
dx
In [62]: latex(d1)
Out[62]: '\\frac{d}{d x} f{\\left(x \\right)} g{\\left(x \\right)}'
In [63]: latex(d2)
Out[63]: '\\frac{d}{d x} f{\\left(x \\right)} g{\\left(x \\right)}'
In [64]: latex(d1) == latex(d2)
Out[64]: True |
Here is an example:
Thus, I suggest that
Derivative.expr
be parenthesized withPRECEDENCE['Mul']
when printed.The text was updated successfully, but these errors were encountered: