Re: a finicky rule
- To: mathgroup at smc.vnet.net
- Subject: [mg41734] Re: [mg41714] a finicky rule
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Tue, 3 Jun 2003 07:13:16 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Look at the output of
Trace[x^3 - x^2 - 1 /. pullx ]
It appears that -1 is matching x in the pullx pattern.
Bobby
-----Original Message-----
From: Selwyn Hollis <selwynh at earthlink.net>
To: mathgroup at smc.vnet.net
Subject: [mg41734] [mg41714] a finicky rule
Group,
I'm having a difficult time understanding the following behavior.
I define this rule:
pullx := c_. + (a_.) x_^(p_.) + (b_.)x_^(q_.) ->
c + x (a x^(p-1) + b x^(q-1))
and it works here:
x^3 + x^2 - 1 /. pullx
-1 + x*(x + x^2)
but not here:
x^3 - x^2 - 1 /. pullx
-1 - x^2 + x^3
even though the pattern matches:
MatchQ[x^3 - x^2 - 1, pullx[[1]]]
True
I thought perhaps some simplification was being done on the result, but:
(x^2 - x)*x - 1
-1 + x (-x + x^2)
Any ideas? (This is 4.1, Mac OS X.)
Thanks.
-----
Selwyn Hollis
http://www.math.armstrong.edu/faculty/hollis