Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Core

New issue 4051 by asmeu...@gmail.com: xreplace and Transform doesn't go deep enough
http://code.google.com/p/sympy/issues/detail?id=4051

I thought this used to work. I had this pasted into a thread in the mailing list from a while ago:

In [7]: a = sin(sin(x) + y) + sin(z)

In [8]: from sympy.core.rules import Transform

In [11]: a.xreplace(Transform(lambda x: cos(x.args[0]), lambda x:
isinstance(x, sin)))
Out[11]: cos(z) + cos(y + cos(x))

But now, I get

In [1]: In [7]: a = sin(sin(x) + y) + sin(z)

In [2]:

In [2]: In [8]: from sympy.core.rules import Transform

In [3]:

In [3]: In [11]: a.xreplace(Transform(lambda x: cos(x.args[0]), lambda x:
   ...: isinstance(x, sin)))
Out[3]: cos(z) + cos(y + sin(x))

i.e., it doesn't replace the inner sin(x). It doesn't work in 0.7.3 or 0.7.2, so I don't know where it started and stopped working.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to