Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If one just wants to test whether a given polynomial $f(x)$ is positive for all real $x$, this can be done without representing $f(x)$ as the sum of squares, using the following function:

def is_pol_positive(f):
    return f.leading_coefficient() > 0 and f.number_of_real_roots() == 0