sympy/sympy — pull request #668 by smichr (2011-10-18 03:07:30+00:00)
Title: 2274 fix extract_multiplicatively for two-arg mul term

Since 2*(1+x) -> 2 + 2*x automatically, the extraction routine should
watch for this.

Also, since the args of c as a Mul are tested at the outset, if self
is a Mul we needn't delete each term to see if the remainder can be
extracted. We only need to see if c can be extracted from any of
the factors.

The two terms are captured into a and b instead of recomputing them.