MathGroup Archive 2001

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

Search the Archive

Re: algebraic substitution rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30736] Re: algebraic substitution rules
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sun, 9 Sep 2001 03:26:25 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9ncfq6$pt5$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

the onlyne help say:


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

since a_ match to the full expression the rule a_->Expand[a]
is used and no future rules are tried on that part.

You mean

1 + x^2 + x^3 + x^4 /.
   {x^2 -> 1 + y, x^3 -> y(1 + y), x^4 -> (1 + y)^2} /. 
     a_ :> Expand[a]

Regards
  Jens

Cattiaux Isabelle wrote:
> 
> 
> 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


  • Prev by Date: Re: Summing list subsets
  • Next by Date: Re: Trigonometry, sine theorem.
  • Previous by thread: Re: algebraic substitution rules
  • Next by thread: RE: algebraic substitution rules