Re: Polynomial rewriting question
- To: mathgroup at smc.vnet.net
- Subject: [mg101421] Re: Polynomial rewriting question
- From: Leonid <lshifr at gmail.com>
- Date: Tue, 7 Jul 2009 05:04:22 -0400 (EDT)
- References: <h2i4q2$93f$1@smc.vnet.net>
Hi Andrew,
One simple way is to substitute x= t+y and then call Simplify:
In[1] =
Clear[p1,p2,p3,x,y,z,w,p,h];
p1 = x*z - y*z;
p2 = x^2*w - 2*x*y*w + y^2 w + p;
p3 = 2*s + h + x - y;
In[2] = Simplify[# /. x -> t + y] & /@ {p1, p2, p3}
Out[2] = {t z,p+t^2 w,h+2 s+t}
Whether or not this will be useful in your setting I don't know -
depends on how complex is the real problem. For polynomials this
should
work.
Regards,
Leonid
On Jul 2, 4:14 am, AndrewTamra <AndrewTa... at yahoo.com> wrote:
> Consider the following polynomials: Here x,y,z,w,h are variables; rest are constants.
> (1) x*z-y*z, (2) x^2*w -2*x*y*w +y^2w + p, (3) 2*s+h+x-y
>
> When we look closely at these, we notice that everywhere x and y occur, they occur as "x-y". Suppose we let t= x-y, then we can rewrite the above polynomials as (1) tz (2) t^2*w (3) 2*s+h+t.
>
> How can do this in Mathematica? i.e., given the above 3 polynomials and the set of variables as input, I should get output of "x-y" and the 3 rewritten polynomials tz, t^2*w, 2*s+h+t.
>
> Note that the above is an example. When I apply the program to any arbitrary and large number of polynomials, in place of "x-y" above, I would like to get the largest polynomial (maximum number of monomial terms) with as many variables in it as possible.
>
> Thanks a lot.
> Andrew.
- Follow-Ups:
- Re: Re: Polynomial rewriting question
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Re: Polynomial rewriting question