Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4580
| From | Peter Pein <petsie@dordos.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Better use of PolynomialReduce? |
| Date | 2011-08-26 09:22 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j37ol1$4c4$1@smc.vnet.net> (permalink) |
| 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
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web