Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

ReplaceList and //.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73569] ReplaceList and //.
  • From: Mr Ajit Sen <senra99 at yahoo.co.uk>
  • Date: Thu, 22 Feb 2007 04:29:16 -0500 (EST)

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: Map function which adds last two numbers of a list
  • Next by Date: Re: Showing that ArcSinh[2]/ArcCsch[2] is 3?
  • Previous by thread: Re: Roman Numerals
  • Next by thread: Re: ReplaceList and //.