NCdiff

description:

[epsilon,X,base,sohs,h,SDP_data] = NCdiff(f,g,params) computes the maximal epsilon such that the polynomial f-epsilon*g is a sum of hermitian squares.

arguments:

f and g are NCpolys representing polynomials.

With params.precision we can set the smallest value that is considered to be nonzero in numerical calculations; if the command is called without it, we assume the precision set with the command NCsetPrecision or the value set in NCparam.m.

params.messages is used to optionally turn on (1) and off (0) verbose output; default value is 1 (on).

params.solver sets the solver to be used for SDP and overrides the value set in the global option file NCparam.m. (currently SeDuMi, SDPA-M or SDPT3 are supported) 

params.eps sets the desired accuracy iy you are using SeDuMi as SDP solver. Setting params.eps=0 lets SeDuMi run as long as it can make progress.

params.justSDP_data == 1 means that the program ends when the SDP_data is prepared and nothing else is computed. It is optional; the default value is 0.

params.decomposition == 0 means that no SOHS decomposition will actually be computed. It is optional; the default value is 1.

output:

epsilon is the maximal number such that f-epsilon*g is a sum of hermitian squares

X is the Gram matrix solution of the corresponding SDP returned by the solver

base is a vector of monomials appearing in the SOHS decomposition of the polynomial f-epsilon*g

sohs is the SOHS decomposition of the polynomial f-epsilon*g

h is the NCpoly representing SOHS decomposition of the polynomial f-epsilon*g

SDP_data is a structure holding all the data used in SDP solver

possible usage:

NCdiff(f,g), NCdiff(f,g,params)

example:

>> f=x^2-x^2*y-y*x^2+y*x^2*y+4*y^2;g=x*y+y*x-2*y*x*y;

>> [epsilon,X,base,sohs,h]=NCdiff(f,g)

***** Optimal solution found:  epsilon_max = 2.000000 *****

epsilon = 2.0000

X = 1.0000   -2.0000   -1.0000

   -2.0000    4.0000    2.0000

   -1.0000    2.0000    1.0000

base = 'x'

       'y'

       'x*y'

sohs = x-x*y-2*y

       3.95e-006*x*y+5.58e-006*y

       2.54e-006*x*y

h = x^2-x^2*y-2*x*y-2*y*x-y*x^2+1*y*x^2*y+4*y*x*y+4*y^2

>> params.precision=1e-4;

>> [epsilon,X,base,sohs,h]=NCdiff(f,g,params)

***** Optimal solution found:  epsilon_max = 2.000000 *****

epsilon = 2.0000

X = 1.0000   -2.0000   -1.0000

   -2.0000    4.0000    2.0000

   -1.0000    2.0000    1.0000

base = 'x'

       'y'

       'x*y'

sohs = x-x*y-2*y

h = x^2-x^2*y-2*x*y-2*y*x-y*x^2+y*x^2*y+4*y*x*y+4*y^2