Comment #12 on issue 2022 by smichr: inconsistent behaviour of subs when using non-commutative symbols
http://code.google.com/p/sympy/issues/detail?id=2022

Yes, the extraction happens internally. You don't/won't know it's happening except that you see exp(4*x).subs(exp(2*x), y) become y**2.

Regarding "all", we can make some progress if we can agree on what to try. What is the objective to do when doing subs? If you mean "given expr.subs(f(x), f(y)) try replace f(x) as a full argument somewhere, but if you can't then see if you can replace it extractively, and if you can't then solve f(x)=f(y), solve for x and then, if there is a single relationship between them, replace x" we can do that:

all=True possible results
(3*x+2).subs(3*x, y) -> y + 2 because of exact arg matching
(3*x+2).subs(3*x+1, y) -> y + 1 because of extractive matching
(6*x+2).subs(3*x+1, y) -> 2*y because of extractive matching
(3*x+2).subs(3*x+5, y) ->y - 3 because of algebraic matching
(3*x+2).subs(sin(x), y) -> 3*asin(y)+2 because of algebraic matching.
(3*x+2).subs(x**2, y) -> no change because there is no single relationship between x and y


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

Reply via email to