Residues of $e^z/ \cosh(z)$ not matching numeric solution

1.9k Views Asked by At

I'm integrating $\frac{e^z dz}{\cosh(z)}$ along a circle of radius $5$ (centered at the origin).

Solving for $\cosh(z) = 0$, one gets $z = (\frac{\pi}{2} + n\pi)i$. Only four of these lie within my circle ($\pi i/2,\ 3\pi i/2 -\pi i/2, -3\pi i/2$). We can evaluate the residue of $\frac{f(x)}{g(x)}$ as $\frac{f(x)}{g'(x)}$, which, in this case, is

$$\frac{e^z}{\sinh(z)}$$

But if you throw the poles into this, you get $1$ for each of these, which means the sum or residuals is 4, meaning the integral should be equal to

$$2\pi i\ \Sigma_i (\text{res}_i) = 2\pi i (4) = 8\pi i$$

But when I evaluate the integral numerically (trapezoidal rule, one million intervals) with a Python program I wrote I get $2\pi$, which suggests the residual-sum should be $\frac{1}{i} = -i$.

Does naive numeric integration fail for complex numbers (this seems unlikely), or have I screwed something up?

1

There are 1 best solutions below

0
On BEST ANSWER

Writing it as a real integral, you have

$$\int_{t=0}^{t=2\pi} \frac{e^{5e^{it}} d(5e^{it})}{\cosh(5e^{it})} = 5i \int_0^{2 \pi} \frac{e^{5e^{it}} e^{it}}{\cosh(5e^{it})} dt.$$

Computing this numerically in Matlab as

5*i*integral(@(t) exp(5*exp(i*t)).*exp(i*t)./(cosh(5*exp(i*t))),0,2*pi)

results in

-0.000000000000007 +25.132741228718409i

dividing that by pi results in

-0.000000000000002 + 8.000000000000020i

So Matlab is giving me essentially $8 \pi i$ as expected.

So there's something wrong with your program or (more likely) with the integrand that you put into it.