Fixed differentation of the cosine function, and add tests for it