Re: ReplaceAll / sequential replacements versus joint replacement

*To*: mathgroup at smc.vnet.net*Subject*: [mg55449] Re: ReplaceAll / sequential replacements versus joint replacement*From*: dh <dh at metrohm.ch>*Date*: Thu, 24 Mar 2005 03:41:49 -0500 (EST)*References*: <d1rhch$45j$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi Ron, I agree, it is confusing. But read the Help of ReplaceAll: "ReplaceAll looks at each part of expr, tries all the rules on it, and then goes on to the next part of expr. The first rule that applies to a particular part is used; no further rules are tried on that part, or on any of its subparts. " Teherefore, consider e.g. x /. {x -> a + x, a -> x} Here only the first rule is applied, giving: a+x However: t1 = x /. {x -> a + x} t1 /. {a -> x} Here after the first rule did its job, the second rules starts over, giving: 2x good advice -:) read the manual! Sincerely, Daniel Ronald Wendner wrote: > Suppose there is an expression e1 which depends, among others, on variables > a and b. > Replace both a and b by zero: > > e1/.{a->0,b->0} Mathematica gives, say, result1. > > Next, consider > > e2 = e1/.{a->0}; > e2/.{b->0} Mathematica gives, say, result2. > > How can result 1 differ from result 2? > > For my specific problem, I also attach a short Mathematica notebook. > [Contact the author to obtain the notebook - moderator] > > I'd appreciate any help. > > Many thanks, > Ron > >