MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Replacement question

  • To: mathgroup at
  • Subject: [mg74219] Re: [mg74156] Replacement question
  • From: Bob Hanlon <hanlonr at>
  • Date: Wed, 14 Mar 2007 03:58:54 -0500 (EST)
  • Reply-to: hanlonr at

Convert the rule to one with an atomic expression on the LHS., i.e., "solve" the replacement rule for one of the other variables, preferably a variable which only occurs in the form to be replaced. So {y+z -> x} goes to either {y -> x-z} or {z -> x-y}

(y+z)^2+3(y+z)-y+z /. z\[Rule]x-y

x^2 + 4*x - 2*y

Bob Hanlon

---- Brian Beckage <Brian.Beckage at> 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.
> Thank you for your help,
> Brian
> -- 
> *********************************************************************
> Brian Beckage
> Department of Plant Biology
> University of Vermont
> Marsh Life Science Building
> Burlington, VT 05405
> *********************************************************************

  • Prev by Date: Re: How do I write tabular output?
  • Next by Date: Re: ComplexityFunction
  • Previous by thread: Re: Replacement question
  • Next by thread: NDSolve and Systems of DEs