Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium NonCommutative Simplify WrongResult

New issue 3618 by [email protected]: Assumptions on replacement symbols created by cse
http://code.google.com/p/sympy/issues/detail?id=3618

When cse creates replacement symbols for what it identifies as a common subexpression, it does not preserve the assumptions on that subexpression.

from sympy import cse, symbols
A, B = symbols('A B', commutative=False)
cse(B*A*A + A*A)
([(x0, A**2)], [x0 + x0*B])
cse(B*A*A - A*A*B)
([], [0])

In the above result from cse, B*A*A has been replaced by A*A*B, disregarding the noncommutativity. If you inspect the created x0 symbol, it only has default assumptions on it:

cse(B*A*A + A*A)[0][0][0]
x0
cse(B*A*A + A*A)[0][0][0].assumptions0
{'commutative': True}

Probably that everything we know about the assumptions on the subexpression should be passed on to the created replacement symbol. This is especially important for is_commutative, since it leads to obvious wrong results.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to