On Wed, May 23, 2012 at 9:26 PM,
krastano...@gmail.com
<
krastano...@gmail.com> wrote:
> I am sorry for not participating in the pull request discussions.
> Maybe this was discussed, but why would you prefer this method instead
> of:
>
> In [3]: (f(x,y)+1).subs(f, Lambda([x, y], x+y))
> Out[3]: x + y + 1
>
> It seems that this does the same thing with a slightly different syntax.
At the suggestion of Aaron, the method also handles linear transforms
(which I am not sure the lambda handles):
```
assert (f(x, y) + f(x + 1, y)).rewrite(f(a - c, b), a**b) == \
(c + x)**y + (c + x + 1)**y
assert (f(x, y) + f(x + 1, y)).rewrite(f(1/a - c, b), a**b) == \
(1/(c + x))**y + (1/(c + x + 1))**y
```