Re: Matrix Form of Quadratic Equations
- To: mathgroup at smc.vnet.net
 - Subject: [mg114309] Re: Matrix Form of Quadratic Equations
 - From: Valeri Astanoff <astanoff at gmail.com>
 - Date: Tue, 30 Nov 2010 06:22:44 -0500 (EST)
 - References: <ico2b2$nq6$1@smc.vnet.net> <ictg19$mjn$1@smc.vnet.net>
 
On Nov 28, 12:56 pm, "gianpf" <jean.pelle... at orange.fr> wrote:
> Salut
>
> Resolve[ForAll[{x, y}, {x, y}.{{a, b}, {b, d}}.{x, y} == x^2 + y^2 - =
2 x y],
> Reals]
>
> a == 1 && b == -1 && d == 1
>
> "Ari" <ari... at finly.net> a =E9crit dans le message denews:ico2b2$nq6$1@=
smc.vnet.net...
>
>
>
> > Hello,
>
> > Could anyone guide me how to build a mathematica module to form a Matri=
x
> > form from a quadratic equations?
> > For example, x^2 + y^2 - 2 x y will output
> > {{1, -1}, {-1, 1}} ?
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
A generalized variant :
In[1]:= bilin[form_, vars_List] :=
 Module[{ lg = Length[vars], a, sym, ai },
 sym = Array[a, {lg, lg}] /. a[i_, j_] /; i > j -> a[j, i];
 ai = Flatten[sym] // Union;
 sym /. (Resolve[ForAll[vars, vars.sym.vars == form], ai] //
 ToRules)
 ];
In[2]:= bilin[a*x^2 + 2*b*x*y + c*y^2, {x, y}]
Out[2]= {{a, b}, {b, c}}
In[3]:= bilin[a*x^2 + 2*b*x*y + c*y^2 + d*z^2, {x, y, z}]
Out[3]= {{a, b, 0}, {b, c, 0}, {0, 0, d}}
v.a.