MathGroup Archive 2003

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

Search the Archive

Re: a finicky rule

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41759] Re: a finicky rule
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 4 Jun 2003 08:34:41 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <bbf2n7$q0v$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,


x^(p_.) and x^(q_.) match to -1

and c is bound to x^3, you can see this form:

pullx = c_. + (a_.) x_^(p_.) + (b_.)x_^(q_.) :> (Print[c]; 
      c + x (a x^(p - 1) + b x^(q - 1)))


and

pullx = c_. + (a_.) x_^(p_.) + (b_.)x_^(q_) /; FreeQ[c, x] :> 
      c + x (a x^(p - 1) + b x^(q - 1))


will work as you expect.

Regards
  Jens

Selwyn Hollis wrote:
> 
> 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


  • Prev by Date: btw...
  • Next by Date: Re: Multiplying permutations
  • Previous by thread: RE: a finicky rule
  • Next by thread: Re: PolyGamma - series expansions