Comment #11 on issue 1497 by asmeurer: Remove automatic distribution 2*(x + y) => 2*x + 2*y
http://code.google.com/p/sympy/issues/detail?id=1497

Thinking about this, there are cases when this behavior is undefined, i.e., when there is a number multiplying
more than one Add:

In [1]: (x + y)*(z + n)
Out[1]: (x + y)⋅(n + z)

In [2]: 2*(x + y)*(z + n)
Out[2]: (n + z)⋅(2⋅x + 2⋅y)

In [3]: (x + y)*2*(z + n)
Out[3]: (n + z)⋅(2⋅x + 2⋅y)

In [4]: (x + y)*(z + n)*2
Out[4]: 2⋅(x + y)⋅(n + z)

In [5]: (z + n)*(x + y)
Out[5]: (x + y)⋅(n + z)

In [6]: 2*(z + n)*(x + y)
Out[6]: (x + y)⋅(2⋅n + 2⋅z)

In [7]: (z + n)*2*(x + y)
Out[7]: (x + y)⋅(2⋅n + 2⋅z)

In [8]: (z + n)*(x + y)*2
Out[8]: 2⋅(x + y)⋅(n + z)

And now that factor(2*x + 2*y) splits it into 2*(x + y) using Mul(evaluate=False), there are problems with issue 1864. So I am totally in favor of removing the automatic distribution entirely. There is expand(mul=True) if you want it, and maybe we could even write a special case that only distributes numbers
if it is important.

The procedure outlined in comment 9 should "fix" it, but many tests will need to be fixed. Hopefully no algorithms rely on this automatic behavior, as was the case when I fixed issue 252 (I had to put some
powsimp lines in the limit algorithm).

--
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-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