Exponential moment of the hyperbolic secant (source code)

= Exponential moment of the hyperbolic secant
{title2=$\int_{\mathbb R}e^{ax}\operatorname{sech}(\pi x)dx=\sec(a/2),\quad |a|<\pi$}

For real $|a|<\pi$, integrate $g(z)=e^{az}/\cosh\pi z$ around a rectangle of height $i$ and width $2R$. Only the <simple pole> $i/2$ lies inside, with <residue> $e^{ia/2}/(\pi i)$. Since $g(x+i)=-e^{ia}g(x)$, the reversed top edge adds $e^{ia}$ times the bottom integral. The two vertical edges vanish as $R\to\infty$, using $|a|<\pi$. The <residue theorem> gives $(1+e^{ia})J=2e^{ia/2}$, proving the formula. The condition is also the exact convergence range: the two tails decay with exponents $\pi-a$ and $\pi+a$.