# Complex Analysis Evaluating Integrals

I'm studying complex analysis and trying to do the following exercise:

Evaluate the following integrals along the curve $\gamma=\gamma_1\dot+\gamma_2$, where $\gamma_1(t)=t+i\cos(\frac{\pi}{2}t),t\in[-1,3]$ and $\gamma_2(t)=(2-t)-i\cos(\frac{\pi}{2}(2-t)),t\in[-1,3]$.

(i) $\int_\gamma\frac{e^z}{z(z-2)}dz$ (ii) $\int_\gamma\frac{3z+1}{z(z-2)^2}dz$

I was trying to use the definition $\int_\gamma f(z)dz=\int f(\gamma(t))\gamma'(t)dt$ but that does not seem to work.

The curve $\gamma=\gamma_1\dot+\gamma_2$, with $\gamma_1(t)=t+i\cos(\dfrac{\pi}{2}t),t\in[-1,3]$ and $\gamma_2(t)=(2-t)-i\cos(\dfrac{\pi}{2}(2-t)),t\in[-1,3]$ is a closed curve, and $\displaystyle I_1=\int_\gamma\frac{e^z}{z(z-2)}dz$ has two poles in it, $z=0$ and $z=2$. With residue theorem we find that $$I_1=2\pi i\left(Res\frac{e^z}{z(z-2)}\Big|_{z=0}+Res\frac{e^z}{z(z-2)}\Big|_{z=2}\right)=\color{blue}{2\pi i\left(-\dfrac12+\frac12e^2\right)}$$