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?
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
results in
dividing that by pi results in
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.