Comment #34 on issue 1358 by wflynny: (e*f*e*f).subs(e*f,f*e+h) fails if e*f is not commutative http://code.google.com/p/sympy/issues/detail?id=1358
Thanks for looking into this. I am glad someone is finally looking over the code instead of the tests it passes/fails, as I am not a very experienced programmer (especially in python), and this was my first time attempting to fix a bug. Originally, the somewhat simple code I wrote failed a lot of tests, so as I tried to fix those failing tests, the _eval_subs method grew larger and larger (most likely unnecessarily so). However, I think the basic strategy is correct. The original method put all elements from the expression into a set, which caused the order they were in and the multiplicity of single elements to be lost. So I took the approach that exists in other related subs methods: breaking up the expression into commutative and noncommutative pieces. From there, its just a matter of looking for the "old" pattern in each piece, taking into account whether "old" is commutative or not. But I found it difficult to make sure all possible cases were covered. Let me know if I can help in anyway. Thanks again for looking at this! wflynny -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to sympy-issues@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 -~----------~----~----~----~------~----~------~--~---