MathGroup Archive 2007

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

Search the Archive

Re: ReplaceList and //.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73597] Re: ReplaceList and //.
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 23 Feb 2007 04:22:26 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <erjo1u$nn5$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

and what say the online help ??

?ReplaceAll
expr /. rules applies a rule or list
of rules in an attempt to transform each
subpart of an expression expr.

?ReplaceRepeated
expr //. rules repeatedly performs replacements until expr no longer 
changes.

Regards
   Jens

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: Find index of maximal element in multi-dimensional array
  • Next by Date: Re: Change multiplication operations into convolution
  • Previous by thread: ReplaceList and //.
  • Next by thread: Re: ReplaceList and //.