MathGroup Archive 2011

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

Search the Archive

Re: Better use of PolynomialReduce?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121062] Re: Better use of PolynomialReduce?
  • From: Peter Pein <petsie at dordos.net>
  • Date: Fri, 26 Aug 2011 05:21:44 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j35al3$og1$1@smc.vnet.net>

Am 25.08.2011 13:11, schrieb Irretrev Unable:
> I've been using
>
>
> scPhiDecomp[expr_]:= PolynomialReduce[expr, {x^2-y^2,2 x y}, {x,y}]
>
> which works great on
>
> scPhiDecomp[a x^2 + 2c x y -a y^2]
>>> {{a,c},0}
>
> but doesn't do what I want on
>
> scPhiDecomp[y (a x^2 + 2c x y -a y^2)]
>>> {{0,(a x)/2+c y},-a y^3}
>
> How do I make scPhiDecomp produce
> {{a y, c y}, 0}
> on the second expression?
>
> Thanks,
> Keith
>

Hi Keith,

the results of PolynomialReduce often depend on the order of the 
variables ( {x, y} vs. {y,x} ).

Try both and select the less complex one.

In[1]:= newscPhiDecomp[expr_] :=
           SortBy[
             PolynomialReduce[expr, {x^2 - y^2, 2*x*y}, #1] &
               /@ {{x, y}, {y, x}},
           LeafCount][[1]]

In[2]:= newscPhiDecomp[a*x^2 + 2*c*x*y - a*y^2]
Out[2]= {{a, c}, 0}

In[3]:= newscPhiDecomp[y*(a*x^2 + 2*c*x*y - a*y^2)]
Out[3]= {{a*y, c*y}, 0}


hth,

  Peter




  • Prev by Date: Re: discrete Fourier transform
  • Next by Date: Re: decoding inbuilt function
  • Previous by thread: Re: Better use of PolynomialReduce?
  • Next by thread: FindRoot repeatedly evaluating function