In response to issue 2022, there is a beta commit available for
testing on my t2 branch at github/smichr. extract_multiplicatively and
Mul.subs are now more nc compliant. I still have to run the full test
suite to see the full impact, but all the issues in 2022 now work:

>>> a,b,c=symbols('abc',commutative=False)
>>> (a*a*a+a*b*a).subs(a*a*a,c)
c + a*b*a
>>> (a*(a+b)*a).subs(a*a*a,c)
a*(a + b)*a
>>> a,b,c=symbols('abc',commutative=True)
>>> var('A', commutative=0)
A
>>> (a*b*A).subs(a*b,c)
c*A

With these changes, too, subs is going to behave (IMHO) in a more
logical manner since it bases its substitution on whether items can be
extrated additively or multiplicatively..."while maintaining the
original structure." So [eventually] (x**3).subs(x**2, y) won't become
y**(3/2) because that changes the structure. And right now,
(1+x).subs(2+x,y) won't become -1 + y because that changes the
structure; (3+x).subs(2+x,y) will become 1+y, though.

Anyway...it's open for testing.

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

Reply via email to