sympy/sympy — pull request #1137 by gdevanla (2012-03-18 11:07:50+00:00)
Title: Avoids expansion of the scalars in front of each Mul

Change qapply() to avoid expanding scalar values when the Mul operation splits an expression into multiple parts for further evaluation. The co-efficient is multiplied to the result after the Mul expression is evaluated.