In more plain English, rationals and floating points are automatically
distributed over addition, and it requires a hack (evaluate=False) to make
them not. See http://code.google.com/p/sympy/issues/detail?id=1497.

Aaron Meurer

On Thursday, September 27, 2012, Chris Smith wrote:

> This is the autoexpansion of the 2-arg, commutative mul. factor
> returns an unevaluated expression in order to keep the leading
> Rational undistributed:
>
> >> 2*(x + y)
> 2*x + 2*y
> >> Mul(2, x + y, evaluate=False)
> 2*(x + y)
> >> (x + y)*x*2 # by the time 2 is handled the expression has 3 args, not 2
> 2*x*(x + y)
> >> 2*(x + y)*x # 2*(x + y) leads to autoexpansion
> (2*x + 2*y)*x
>
> It could be that factor is not watching for the extracted Rational and
> thus doesn't use the unevaluated Mul option.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected] <javascript:;>
> .
> To unsubscribe from this group, send email to
> [email protected] <javascript:;>.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
>

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