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 = 3.30453e-9*(.34757x  - .0338184x*y + .768917y  + .336255x*z - .203874y*z + .363573z )  + 5.71255e-9*(.318117x  + .679504x*y - .00674107y  + .148907x*z + .644086y*z - .00319983z )  + .612613*(- .4895x  + .515359x*y - .174267y  + .126103x*z - .330014y*z + .582764z )  + .889187*(- .38915x  + .18471x*y + .19141y  + .590209x*z - .140291y*z - .640139z )  + 1.85689*(.622038x  + .195425x*y - .441066y  + .199984x*z - .564971y*z - .145439z )  + 3.99241*(.00407887x  - .446349x*y - .383633y  + .678614x*z + .309523y*z + .311865z )

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 = .612613*(- .4895x  + .515359x*y - .174267y  + .126103x*z - .330014y*z + .582764z )  + .889187*(- .38915x  + .18471x*y + .19141y  + .590209x*z - .140291y*z - .640139z )  + 1.85689*(.622038x  + .195425x*y - .441066y  + .199984x*z - .564971y*z - .145439z )  + 3.99241*(.00407887x  - .446349x*y - .383633y  + .678614x*z + .309523y*z + .311865z )

o4 : SOSPoly

See also


The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/SumsOfSquares/SOSdoc.m2:109:0.