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