AW: Question about Replace
- To: mathgroup at smc.vnet.net
- Subject: [mg35691] AW: [mg35670] Question about Replace
- From: Matthias.Bode at oppenheim.de
- Date: Fri, 26 Jul 2002 04:16:34 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello Heather,
there is a simple way, try:
In[80]:=
expr=x+y+z/(x+y)+e^(x+y)+w*x+y
expr/.{(x+y)->s}
%/.{s->x}
It works here; the intermediate substitution "s" was made to see it at a
glance.
Best regards,
Matthias Bode
-----Ursprüngliche Nachricht-----
Von: xzhang2 at is2.dal.ca [mailto:xzhang2 at is2.dal.ca]
Gesendet: Donnerstag, 25. Juli 2002 10:46
An: mathgroup at smc.vnet.net
Betreff: [mg35670] Question about Replace
Hello All,
I have an expression: x+y+z/(x+y)+e^(x+y)+w*x+y.... I want to replace
any (x+y) term by x no matter how the expression looks like. I tried
"/."command. However, it does not work properly. Is there any simple way
of doing this? Thanks.
--
Xuguang(Heather) Zhang