MathGroup Archive 2007

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

Search the Archive

Re: ReplaceList and //.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73600] Re: ReplaceList and //.
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 23 Feb 2007 04:24:05 -0500 (EST)
  • References: <erjo1u$nn5$1@smc.vnet.net>

Hi Ajit,

ReplaceList applies the first rule in all possible ways, then the 

second,.. and returns a list of all the results where a replacement has 

been done.

//. Applies the first rule, then to the result the second rule,.. After 

this it starts over with the first rule until nothing changes anymore. 

It then returns the last expression.



Mr Ajit Sen wrote:

> Dear Mathgroup,

> 

>  Could someone please enlighten me as to when I should

> use  ReplaceList and when to use //.  in pattern

> matching.

> 

>   Thus, if  Y = a x^2/b^3,  then

> 

>    ReplaceList[Y, a^m_. x^n_. b^p_. :> z 

>     b^(p + 1) a^(m - 1) x^(n - 1)][[1]]

> 

>  as well as 

>    

>   Y //. a^m_. x^n_. b^p_. :> z b^(p + 1) a^(m - 1)

> x^(n - 1)

>   

> give the same result.

> 

>  However,

> 

>      ReplaceList[a*b*c, {(x_)*(y_) -> x^y, (x_)*(y_)

> -> x + y}]

> 

>  and 

>       a*b*c //. {(x_)*(y_) :> x^y, (x_y)*_ :> x + y}

> 

>   yield different outputs.

> 

>  What am I missing here?

> 

>   Thanks in advance.

> 

> 

>   Ajit Sen.

> 

> 

> 

> 

> 

> 		

> ___________________________________________________________ 

> What kind of emailer are you? Find out today - get a free analysis of your email personality. Take the quiz at the Yahoo! Mail Championship. 

> http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

> 




  • Prev by Date: Re: split
  • Next by Date: Re: split
  • Previous by thread: Re: ReplaceList and //.
  • Next by thread: Re: ReplaceList and //.