sympy/sympy — pull request #1245 by smichr (2012-04-17 09:31:05+00:00)
Title: WIP give cse a postprocess option

There are some predifined post-processors in cse_main which allow the
return value of a call to cse to be modified:

>>> eq = (x+1+exp((x+1)/(y+1))+cos(y+1))
>>> from sympy.simplify.cse_main import *
>>> cse(eq)
([(x0, y + 1), (x1, x + 1)], [x1 + exp(x1/x0) + cos(x0)])
>>> cse(eq, postprocess=cse_reversed)
[[(x1, x + 1), (x0, y + 1)], [x1 + exp(x1/x0) + cos(x0)]]
>>> cse(eq, postprocess=cse_dict_expr)
[{x0: y + 1, x1: x + 1}, x1 + exp(x1/x0) + cos(x0)]
>>> cse([eq, Eq(x, z + 1), z - 2], postprocess=cse_separate)
[[(x0, y + 1), (x, z + 1), (x1, x + 1)], [x1 + exp(x1/x0) + cos(x0), z - 2]]