# Problem calculating with the residue theorem

I've come across this integral and I'm having some problems with it. I get to a solution, but looks a bit weird and I may be doing something wrong.

$\int_C\cos(e^{(1/z)})dz$

Being $C$ the unit circle.

I've tried to calculate the residue at z=0, which is the only singularity (and it's essential). I do the following:

$$e^{1/z} = \sum_0^\infty \frac{1}{n!z^n}$$

$$\cos (x) = 1-x^2/2+x^4/4! + \ldots$$

I've found that the term that goes with 1/z for every x^n in the cosine, after substituting x=exp(1/z), is n/z, that means, the term 1/z will be:

$$\sum_1^\infty \frac{(-1)^n}{(2n-1)!z}=\sum_0^\infty \frac{(-1)^{n+1}}{(2n+1)!z}$$

That means the residue is:

$$\sum_0^\infty \frac{(-1)^{n+1}}{(2n+1)!}$$

Which is $-sin(1)$, so the integral would be $-2\pi i\sin(1)$

Don't know why, but doesn't look good. Can someone confirm this is right or tell me what I'm doing wrong? Thank you.

-
Without going deep into the calculation of the coefficient of $\,1/z\,$ (which btw, looks correct), all the rest seems fine. –  DonAntonio Dec 1 '12 at 16:30
Ok, thank you very much. Actually, I had tried to use Wolfram to calculate the residue and it wasn't working, but just 1 minute ago it worked and I could see the residue is actually -sin(1), so again, thank you very much. –  MyUserIsThis Dec 1 '12 at 16:42