MathGroup Archive 2010

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

Search the Archive

Re: coefficients of polynomial

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107963] Re: [mg107939] coefficients of polynomial
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 4 Mar 2010 05:26:34 -0500 (EST)
  • References: <31952838.1267614365997.JavaMail.root@n11>

First, you have to learn the proper method for writing equations in
Mathematica. There must be spaces between symbols to give multiplication
(otherwise something like bxy is considered to be a single symbol). Then you
must use "==" for Equal and not "=", which stands for Set.

Then, copy and paste the following in your notebook and evaluate for the
solution.

Print["Solve for d, e and f in the following equation."]
eqn = a x^2 + b x y + c y^2 == 
  d (x + y)^2 + e (x - y)^2 + f (x^2 - y^2)
Print["Extract the coefficients of all the 2nd order terms on both \
sides."]
step1 = Coefficient[#, {x^2, x y, y^2}] & /@ eqn
Print["Thread the two lists over equal to obtain individual \
equations."]
step2 = Thread[step1]
Print["Now Solve for d, e and f."]
defsols = Solve[step2, {d, e, f}][[1]]  

In step1 Coefficient[#, {x^2, x y, y^2}] & is a pure function (look up
Function in Help) that finds a list of coefficients in a polynomial
expression. "/@" maps this to both sides of the equation. (Look up Map).

Step2 was not actually necessary as the Mathematica Solve will also solve
"vector" equations.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Jim Armstrong [mailto:yusufenginn at yahoo.com] 

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: coefficients of polynomial
  • Next by Date: Re: Re: "changebit" front-end option for Demonstrations NBs
  • Previous by thread: Re: coefficients of polynomial
  • Next by thread: Re: coefficients of polynomial