Evaluates a polynomial.