Macaulay2 » Documentation
Packages » SumsOfSquares :: sosPoly
next | previous | forward | backward | up | index | toc

sosPoly -- make an SOS polynomial

Synopsis

Description

This method creates an object of type SOSPoly. Very often this is applied to an object of type SDPResult, the result of a semidefinite programming computation.

i1 : R = QQ[x,y];
i2 : f = 2*x^4+5*y^4-2*x^2*y^2+2*x^3*y;
i3 : sosPoly solveSOS f

            83 2    2 2    43  20 2       2    231773   2 2
o3 = (5)(- ---x  + y )  + (--)(--x  + x*y)  + (------)(x )
           200             20  43              344000

o3 : SOSPoly

One can also input a Gram matrix $Q$ and a vector of monomials $mon$.

i4 : Q = matrix(QQ,{{1,1,1},{1,1,1},{1,1,1}});

              3       3
o4 : Matrix QQ  <-- QQ
i5 : mon = matrix{{1},{x},{y}};

             3      1
o5 : Matrix R  <-- R
i6 : sosPoly(mon,Q)

                   2
o6 = (1)(x + y + 1)

o6 : SOSPoly

Alternatively, a sum-of-squares polynomial can be created from a list of generators and weights.

i7 : s = sosPoly(R, {x+1,y}, {2,3} )

              2        2
o7 = 2*(x + 1)  + 3*(y)

o7 : SOSPoly

      

See also

Ways to use sosPoly :

For the programmer

The object sosPoly is a method function.