next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
SOS :: sosPoly

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 an SDP 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
Executing CSDP
Input file: /tmp/M2-3824298-0/4.dat-s
Output file: /tmp/M2-3824298-0/5
Status: SDP solved, primal-dual feasible
Start rational rounding

o3 = coeffs:
         43  231773
     {5, --, ------}
         20  344000
     gens:
         83 2    2  20 2         2
     {- ---x  + y , --x  + x*y, x }
        200         43

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)

o6 = coeffs:
     {1}
     gens:
     {x + y + 1}

o6 : SOSPoly

Alternatively, an SOS polynomial can be created from a list of generators and weights.

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

o7 = coeffs:
     {2, 3}
     gens:
     {x + 1, y}

o7 : SOSPoly

See also

Ways to use sosPoly :