User:Sam Derbyshire/Test

$$f(z) = \frac{e^z}{z^5 - z^4 + 2z^3 - 2z^2 + z - 1}$$

$$z^5 - z^4 + 2z^3 - 2z^2 + z - 1 = (z^2+1)^2(z-1) = (z-i)^2(z+i)^2(z-1)$$

And $$e^z \not= 0$$

As such, $$f(z) = \frac{e^z}{(z-i)^2(z+i)^2(z-1)}$$ has a pole of order 1 at z = 1 and two poles of order two at z = i and z = -i.

Let $$\gamma$$ be some Jordan curve around all these three poles : for example, the curve parametrized by $$2e^{it}$$ with $$ 0 \le t \le 2\pi$$.

Then $$\oint_{\gamma} f(z) dz = 2 \pi i \Big( \operatorname{Res}_{z = i} f(z) + \operatorname{Res}_{z = -i}f(z) + \operatorname{Res}_{z = 1}f(z) \Big)$$ by the residue theorem.

$$ \operatorname{Res}_{z = 1} (f(z)) = \frac{1}{2 \pi i} \oint_{\gamma_1}f(z) dz = \frac{1}{2 \pi i} \oint_{\gamma_1} \frac{e^z}{(z-i)^2(z+i)^2(z-1)} = \frac{1}{2 \pi i}  \oint_{\gamma_1} \frac{ \frac{e^z}{(z-i)^2(z+i)^2}}{z-1} dz$$

But the residue of a function f(z) at a simple pole c is given by $$\operatorname{Res}_{z=c} f(z) = \lim_{z \rightarrow c} (z-c)f(z)$$.

Thus $$ \frac{1}{2 \pi i} \oint_{\gamma_1} \frac{ \frac{e^z}{(z-i)^2(z+i)^2}}{z-1} dz = \lim_{z \rightarrow 1}  \frac{e^z}{(z-i)^2(z+i)^2} = \frac{e^1}{(1-i)^2(1+i)^2} = \frac{e^1}{(-2i)(2i)} = \frac{e}{4}$$.

Then $$ \operatorname{Res}_{z = 1} f(z) = \frac{e}{4}$$

$$ \operatorname{Res}_{z = i} (f(z)) = \frac{1}{2 \pi i} \oint_{\gamma_i} \frac{ \frac{e^z}{(z+i)^2(z-1)}}{(z-i)^2} dz$$.

This time, the pole is of second order, thus its residue is given by the formula :

$$ \operatorname{Res}_{z = c} f(z) = \frac{1}{(n-1)!} \lim_{z \rightarrow c} \left(\frac{d}{dz}\right)^{n-1}\left( f(z)\cdot (z-c)^{n} \right)$$, where n is the order of the pole.

Thus, $$ \operatorname{Res}_{z = i} f(z) = \lim_{z \rightarrow i} \frac{d}{dz}\big(f(z)(z-i)^2\big) = \lim_{z \rightarrow i} \frac{d}{dz}\bigg( \frac{e^z}{(z+i)^2(z-1)}\bigg) = \lim_{z \rightarrow i} \frac{e^z(z^2 - 4z +iz +2 -2i)}{(z+i)^3(z-1)^2} = \frac{3ie^i}{8}$$.

$$ \operatorname{Res}_{z = -i} (f(z)) = \frac{1}{2 \pi i} \oint_{\gamma_{-i}} \frac{ \frac{e^z}{(z-i)^2(z-1)}}{(z+i)^2} dz$$.

Following the same procedure :

$$ \operatorname{Res}_{z = -i} f(z) = \lim_{z \rightarrow -i} \frac{d}{dz}\big(f(z)(z+i)^2\big) = \lim_{z \rightarrow -i} \frac{d}{dz}\bigg( \frac{e^z}{(z-i)^2(z+1)}\bigg) = \lim_{z \rightarrow -i} \frac{e^z(z^2 - 4 z - 4iz + 2 + 2i)}{(z-i)^3(z+1)^2} = - \frac{3ie^i}{8}$$.

So \oint_{\gamma} f(z) dz = 2 \pi i \Bigg( \frac{e}{4} + \frac{3ie^i}{8} - \frac{3ie^i}{8} \Bigg) = \frac{e \pi i}{2}.