NCisConvex0

description:

[isConvex,g,sohs] = NCisConvex0(f,precision) checks if the polynomial f is convex, i.e., if its second directional derivative is a sum of hermitian squares.

arguments:

f is an NCpoly representing a polynomial.

With 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.

output:

isConvex equals 1 if the polynomial f is convex and 0 otherwise

g is an NCpoly representing the second derivative of the polynomial f

sohs is a SOHS decomposition for the polynomial g if the polynomial f is convex

possible usage:

NCisConvex0(f), NCIsConvex0(f,precision)

example:

>> [isConvex,g,sohs]=NCisConvex0(2*x^2-x*y-y*x+y^2)

isConvex = 1

g = 4*h1^2-2*h1*h2-2*h2*h1+2*h2^2

sohs = 2*h1-h2

       h2