Comment #5 on issue 1497 by asmeurer: (x+y)/-z does not automatically expand to (-x - y)/z http://code.google.com/p/sympy/issues/detail?id=1497
I generally agree with what you are saying. Checking each possible combination that we want to distribute can get ugly, though note that things will tend to be a little uglier at the class level simply because that is where there is less abstraction, indeed, that is where the abstraction takes place. Thus we have all kinds of things like dicts of coeffs and c_part lists that nothing outside of Mul needs to even know exists. Also, I should point out that Ondrej figured out that putting parentheses around the expression also prevents the minus sign from distributing: >>> print -((x+y)/z) -(x + y)/z >>> print -2*(x+y)/z (-2*x - 2*y)/z >>> print -2*((x+y)/z) -2*(x + y)/z >>> print -2*((x+y)) # no such luck here -2*x - 2*y >>> print -((x+y)*(x/z)) # from comment 3 -x*(x + y)/z So if someone wants to keep it from happening, there is a way do to it, at least if the expression is a fraction. And at any rate, expand should normalize expressions of this type (expand_mul in particular), if you need to check for equality. -- 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 [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-issues?hl=en -~----------~----~----~----~------~----~------~--~---
