MathGroup Archive 1998

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

Search the Archive

Re: How does a rule get applied?



hi,

read the chapter in The Book about evaluation order : things like (1+3)
get evaluated before the rule applies. You can prevent it by HoldForm:

HoldForm[  x^3 + x^(1+3) ] /. x^(n_) + x^(n_+1) ->0

0

wouter.


At 11:15 14-05-98 -0400, Yacine Ait-Sahalia wrote:
>Hi,
>
>I'm having trouble understanding how rules are applied after /. Consider
>the following example:
>          x^a + x^(1+a)  /. x^(n_) + x^(n_+1) ->0
>          x^3 + x^(1+3)  /. x^(n_) + x^(n_+1) ->0
>          x^3            /. x^(n_) ->0
>
>Out[388]= 
>                0
>
>Out[389]=
>                 3    4
>                x  + x
>
>Out[390]=
>                0
>
>
>Could anyone please explain to me why 
>
>        x^a + x^(1+a)  /. x^(n_) + x^(n_+1) ->0 
>
>returns 0 (as expected), whereas
>
>        x^3 + x^(1+3)  /. x^(n_) + x^(n_+1) ->0
>
>returns
>
>                 3    4
>                x  + x 
>
>instead of 0?
>
>Thanks for your help.   
>
>
Dr. Wouter L. J. MEEUSSEN
w.meeussen.vdmcc@vandemoortele.be
eu000949@pophost.eunet.be




  • Prev by Date: mathfont.ini
  • Next by Date: Worldwide Mathematica Conference Training Opportunities
  • Prev by thread: Re: How does a rule get applied?
  • Next by thread: Re: How does a rule get applied?