Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4565 > unrolled thread

Better use of PolynomialReduce?

Started byIrretrev Unable <irdeva_ble@yahoo.com>
First post2011-08-25 11:11 +0000
Last post2011-08-26 09:22 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Better use of PolynomialReduce? Irretrev Unable <irdeva_ble@yahoo.com> - 2011-08-25 11:11 +0000
    Re: Better use of PolynomialReduce? Peter Pein <petsie@dordos.net> - 2011-08-26 09:22 +0000

#4565 — Better use of PolynomialReduce?

FromIrretrev Unable <irdeva_ble@yahoo.com>
Date2011-08-25 11:11 +0000
SubjectBetter use of PolynomialReduce?
Message-ID<j35al3$og1$1@smc.vnet.net>

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

[toc] | [next] | [standalone]


#4580

FromPeter Pein <petsie@dordos.net>
Date2011-08-26 09:22 +0000
Message-ID<j37ol1$4c4$1@smc.vnet.net>
In reply to#4565
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web