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

coefficient field -- the role of the coefficient field

The SumsOfSquares package works with two coefficient rings: the rational numbers $\QQ$ and the real numbers $\RR$. Almost all operations in this package rely on a numerical semidefinite programming Solver. When calling such a solver, even if the input was a polynomial with rational coefficients, the result is numerical. The package makes some effort to round and return a rational result, but this can fail, independent of whether a rational sum-of-squares decomposition exists or not. In case of failure, a real result is returned. The following example of Scheiderer is a sum of squares, but does not admit any rational decomposition. Consequently the package must return a real solution.

i1 : f = library("Scheiderer", QQ[x,y,z])

      4      3    4     2          2      2 2      3      3    4
o1 = x  + x*y  + y  - 3x y*z - 4x*y z + 2x z  + x*z  + y*z  + z

o1 : QQ[x..z]
i2 : sol = solveSOS (f);
i3 : sosPoly sol

                         2                         2                                     2 2                       2                        2                                      2 2                      2                        2                                     2 2                      2                        2                                     2 2                    2                        2                                    2 2                     2                        2                                     2 2
o3 = 2.75424e-9*(.400914x  + .0937953x*y + .754102y  + .358162x*z - .079895y*z + .356564z )  + 3.04008e-8*(.247531x  + .673848x*y - .150347y  + .0834269x*z + .67085y*z - .0710908z )  + .613162*(- .488646x  + .516019x*y - .174631y  + .126106x*z - .331153y*z + .582142z )  + .888429*(- .390275x  + .184667x*y + .192772y  + .589021x*z - .139394y*z - .640348z )  + 1.85636*(.622005x  + .195485x*y - .440005y  + .200246x*z - .565061y*z - .14798z )  + 3.99338*(.0039792x  - .445579x*y - .384013y  + .679568x*z + .308528y*z + .311408z )

o3 : SOSPoly

Given a sum-of-squares decomposition with real coefficients, it is often useful to ignore the squares with very small coefficients. The function clean(RR,SOSPoly) removes the squares whose coefficients are smaller than a given tolerance.

i4 : clean (0.001, sosPoly sol)

                        2                        2                                     2 2                      2                        2                                     2 2                    2                        2                                    2 2                     2                        2                                     2 2
o4 = .613162*(- .488646x  + .516019x*y - .174631y  + .126106x*z - .331153y*z + .582142z )  + .888429*(- .390275x  + .184667x*y + .192772y  + .589021x*z - .139394y*z - .640348z )  + 1.85636*(.622005x  + .195485x*y - .440005y  + .200246x*z - .565061y*z - .14798z )  + 3.99338*(.0039792x  - .445579x*y - .384013y  + .679568x*z + .308528y*z + .311408z )

o4 : SOSPoly

See also