polynomial: add some utility functions + some fixes.

There was an error with linear polynomials and min().