Calculate the integral $\int_{\partial D} \frac{z+4}{z-4}\frac{e^z}{\sin z} dz$.

Take the rectangle $D = \{ z\in\mathbb{C};|x|\leq 2,|y|\leq 1\}$. I need to calculate the integral $$\int_{\partial D} \frac{z+4}{z-4}\frac{e^z}{\sin z} dz.$$ The only singularity in this case is in $z=0$. I've tried using the residue theorem, but I just can't work it out. How do I handle this problem?


If $f(z)=\frac{z+4}{z-4}e^z$ then you are integrating $\frac f\sin$. And\begin{align}\int_{\partial D}\frac{f(z)}{\sin z}\,\mathrm dz&=2\pi i\operatorname{res}_{z=0}\left(\frac{f(z)}{\sin z}\right)\\&=2\pi i\frac{f(0)}{\sin'(0)}\\&=-2\pi i.\end{align}


Using the limit definition of the residue at a first order pole at $z=c$ $$ \text{Res}_{z=c}f(z)=\lim_{z\to c}(z-c)f(z) $$ and the standard limit $$ \lim_{z\to 0}\frac{z}{\sin(z)}=1 $$ It is then rather straightforward to show that $$ \text{Res}_{z=0}\left(\frac{z-4}{z+4}\frac{e^{z}}{\sin(z)}\right)=-1 $$ Alternatively, making a Laurant expansion about $z=0$ (using the geometric series to expand $\frac{1}{\sin(z)}$), shows that $$ \frac{z-4}{z+4}\frac{e^{z}}{\sin(z)}=-\frac{1}{z}+\mathcal{O}(1)\text{ , as z}\to\text{ 0} $$ which of course yields the same result.