calculates the first derivative of a poly function