sympy/sympy — pull request #2062 by smichr (2013-05-01 15:18:05+00:00)
Title: modify replace to truly act from the bottom up

Previously, replace would not target any subexpression in which
subexpressions were changed, so x*(x*y + 1) would become x*(2*x*y + 1)
if all Muls were being multiplied by 2. Now 2*x*(2*x*y + 1) is
obtained.

Add more explanations to replace's docstring in response to [issue 2511](https://code.google.com/p/sympy/issues/detail?id=2511).