Differentiation of a polynomial function