Calculating the derivative of a polynomial function.