Differentiation of a trigonometric function