Re: algebraic substitution rules
- To: mathgroup at smc.vnet.net
- Subject: [mg30757] Re: algebraic substitution rules
- From: "Orestis Vantzos" <atelesforos at hotmail.com>
- Date: Sun, 9 Sep 2001 03:27:06 -0400 (EDT)
- Organization: National Technical University of Athens, Greece
- References: <9ncfq6$pt5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Well, Mathematica begins to apply the rules (oh, and never use a_->Expand[a], always a:>Expand[a]) , so it looks at the whole expression and finds that the pattern of the last rule is valid .... 1+x^2+x^3+x^4 is an a_ so it expands it and returns exactly the same. Content, it stops there (since only one rule is applied to each part of an expression). Orestis "Cattiaux Isabelle" <Isabelle.Cattiaux at univ-valenciennes.fr> wrote in message news:9ncfq6$pt5$1 at smc.vnet.net... > > Hi, > > Could someone tell me why the first substitution rule > works and the second doesn't > > In[1]:== > 1+x^2+x^3+x^4 /. {x^2->1+x ,x^3->x(1+x) ,x^4->(1+x)^2} > > Out[1]== > 2 + x + x(1 + x)+ (1 + x)^2 > > In[78]:== > 1+x^2+x^3+x^4 /. {x^2->1+x ,x^3->x(1+x) ,x^4->(1+x)^2,a_->Expand[a]} > > Out[78]== > 1 + x^2 + x^3 + x^4 > > -- > Isabelle Cattiaux-Huillard > Universite de Valenciennes >