Re: Replacement question
- To: mathgroup at smc.vnet.net
- Subject: [mg74193] Re: Replacement question
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 14 Mar 2007 03:44:35 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <et5nnh$jhk$1@smc.vnet.net>
Brian Beckage wrote: > I apologize for this very basic question. I understand how to use /. > {} to replace a variable with a more complex expression, e.g., x-> > y+z. Can one move in the opposite direction to replace all > occurrences of y+z with x? myExpression/.{y+z->x} does not seem to > work. That works: In[1]:= expr = z + y + a + b + 2*c + 2*d; expr /. y + z -> x Out[2]= a + b + 2 c + 2 d + x Now, could you, please, post an example of an expression for which the replacement rule does not work? Regards, Jean-Marc