MathGroup Archive 2010

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

Search the Archive

Re: coefficients of polynomial

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107964] Re: [mg107939] coefficients of polynomial
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Thu, 4 Mar 2010 05:26:45 -0500 (EST)
  • References: <201003031052.FAA20347@smc.vnet.net>

Hi Jim,

Here is one way: first subtract the r.h.s from the l.h.s.:

In[8]:= expr =
 a x^2 + b x y + c y^2 - (d (x + y)^2 + e (x - y)^2 + f (x^2 - y^2))

Out[8]= a x^2 - e (x - y)^2 + b x y + c y^2 - d (x + y)^2 -
 f (x^2 - y^2)

Here is one possible way to find non-zero coefficients:

In[9]:= coeffs =
 Flatten@DeleteCases[
   CoefficientList[Collect[Expand[expr], {x, y}], {x, y}], 0, Infinity]

Out[9]= {c - d - e + f, b - 2 d + 2 e, a - d - e - f}

Now you just call Solve  (Thread is used to construct equations):

In[11]:= Solve[Thread[coeffs == 0], {d, e, f}]

Out[11]= {{d -> 1/4 (a + b + c), e -> 1/4 (a - b + c),
  f -> (a - c)/2}}



Regards,
Leonid


On Wed, Mar 3, 2010 at 1:52 PM, Jim Armstrong <yusufenginn at yahoo.com> wrote:

> Hi,
>
> I am trying to find the coefficients d,e,f of this simple equating:
>
> ax^2+bxy+cy^2=d(x+y)^2+e(x-y)^2+f(x^2-y^2)
>
> I mean I am waiting for this type of solution:
>
> d=(a-b+c)/2
> e=b/2
> f=(a-c)/2
>
> so how can I get these constants?
>
> I searched it and tried to use Solve, Expand...but either they dont give it
> or they solve it in terms of all terms (a,b,c,x,y).
>
> Thanks a lot
>
>



  • Prev by Date: Re: edge labels
  • Next by Date: Re: ListContourPlot3D - only working with arrays?
  • Previous by thread: Re: coefficients of polynomial
  • Next by thread: Re: coefficients of polynomial