Do these integrals have a closed form? $I_1 = \int_{-\infty }^{\infty } \frac{\sin (x)}{x \cosh (x)} \, dx$

First I'm going to evaluate $$\int_{-\infty}^{\infty} \frac{\cos ax}{\cosh x} \ dx .$$

Integrate the function $ \displaystyle f(z) = \frac{e^{iaz}}{\cosh z}$ around a rectangle on the complex plane with vertices at $z= R$, $ z= R + i \pi$, $z= -R + i \pi$, and $z= - R$.

As $R \to \infty$, $ \displaystyle \int f(z) \ dz$ vanishes on the left and right sides of the rectangle.

So going around the rectangle counterclockwise, we get

$$ \int_{-\infty}^{\infty} f(x) \ dx + \int_{\infty}^{-\infty} f(t + i \pi) \ dt = 2 \pi i \ \text{Res} [f(z),i \pi] ,$$

which implies

$$ (1+ e^{- a \pi}) \int_{-\infty}^{\infty} \frac{e^{iax}}{\cosh x} \ dx = 2 \pi i \lim_{z \to i \pi /2} \frac{e^{iaz}}{\sinh z} = 2 \pi \ e^{- a \pi /2} .$$

And equating the real parts on both sides of the equation, we get

$$ \int_{-\infty}^{\infty} \frac{\cos ax}{\cosh x} \ dx = \frac{2 \pi}{e^{a \pi /2} + e^{- a \pi/2}} = \pi \ \text{sech} \left( \frac{a \pi}{2}\right) .$$

Then

$$ \begin{align} \int_{0}^{a} \int_{-\infty}^{\infty} \frac{\cos ax}{\cosh x} \ dx \ da &= \int_{-\infty}^{\infty} \int_{0}^{a} \frac{\cos ax}{\cosh x} \ da \ dx \\ &= \int_{-\infty}^{\infty} \frac{\sin ax}{x \cosh x} \ dx \\ &= \pi \int_{0}^{a} \text{sech} \left(\frac{a \pi}{2} \right) \ da \\ &= 2 \int_{0}^{a \pi /2} \text{sech}(u) \ du \\ &= 4 \int_{0}^{a \pi /2} \frac{e^{u}}{1+e^{2u}} \ du \\ &= 4 \int_{1}^{e^{a \pi /2}} \frac{1}{1+w^{2}} \ dw \\ &= 4 \left(\arctan (e^{a \pi /2}) - \frac{\pi}{4} \right) . \end{align}$$

Therefore,

$$ \int_{-\infty}^{\infty} \frac{\sin x}{x \cosh x} \ dx = 4 \arctan (e^{\pi /2}) - \pi \approx 2.3217507819 . $$


For the first one we need: $$\int _{-1/2}^{1/2}\!{{\rm e}^{2\,iax}}{da}={\frac {\sin \left( x \right) }{x}}\tag{1}$$ $$ \frac{1}{\cosh \left( x \right)}=-2\,\sum _{n=1}^{\infty } \left( -1 \right) ^{n}{{\rm e}^{- \left| x \right| \left( 2\,n-1 \right) }}\tag{2}$$ $$\int _{-\infty }^{\infty }\!{{\rm e}^{2\,iax}}{{\rm e}^{- \left| x \right| \left( 2\,n-1 \right) }}{dx}=- \frac{1}{\left( 2\,ia-2\,n+1 \right) }- \frac{1}{\left( -2\,ia-2\,n+1 \right)}\tag{3}$$ $$-2\,\sum _{n=1}^{\infty } \left( -1 \right) ^{n} \left(- \frac{1}{\left( 2\,ia-2\,n+1 \right) }- \frac{1}{\left( -2\,ia-2\,n+1 \right)} \right) ={ \frac {\pi }{\cosh \left( \pi \,a \right) }}\tag{4}$$ we get:

$$ \begin{aligned} \int _{-\infty }^{\infty }\!{\frac {\sin \left( x \right) }{x\cosh \left( x \right) }}{dx}&=\int _{-1/2}^{1/2}\!{\frac {\pi }{\cosh \left( \pi \,a \right) }}{da}\\ &=2\,\arctan \left( { {\rm e}^{1/2\,\pi }} \right)-2\,\arctan \left( {{\rm e}^{-1/2\,\pi }} \right)\\ &=2\,\arctan \left( \sinh \left( \frac{1}{2}\,\pi \right) \right) \end{aligned}\tag{5}$$ where the last part follows from $(2)$ and the Taylor series for arctan: $$\arctan \left( x \right) =\sum _{n=0}^{\infty }{\frac { \left( -1 \right) ^{n}{x}^{2\,n+1}}{2\,n+1}}\tag{6}$$

For the second one we need: $$ \frac{1}{\sinh \left( x \right) }=2\,\sum _{n=1}^{\infty } {{\rm e}^{-x \left( 2\,n-1 \right) }}\tag{7}$$ $${\frac { \sin^2 \left( x \right)}{x}}=-\frac{1}{2}\,\sum _{ m=1}^{\infty }{\frac { \left( -1 \right) ^{m}{2}^{2\,m}{x}^{2\,m-1}}{ \left( 2\,m \right) !}}\tag{8}$$ $$\int _{0}^{\infty }\!{x}^{2\,m-1}{{\rm e}^{-x \left( 2\,n-1 \right) }} {dx}={\frac { \left( 2\,m-1 \right) !}{ \left( 2\,n-1 \right) ^{2\,m}} }\tag{9}$$ $$\cot \left( z \right) -\frac{1}{z}=-\frac{2}{\pi}\,\sum _{m=1}^{\infty }\zeta \left( 2\,m \right) \left( {\frac {z}{\pi }} \right) ^{2\,m-1}\tag{10}$$ From $(6,7,8)$: $$ \begin{aligned} \int _{0}^{\infty }\!{\frac { \sin^2 \left( x \right)}{x\sinh \left( x \right) }}{dx}&=-\frac{1}{2}\,\sum _{m=1}^{\infty } \left( \frac{\left( -4 \right) ^{m}}{m}\sum _{n=1}^{\infty }{\frac {1}{\left( 2\,n-1 \right) ^{2\,m}}} \right)\\ &=\frac{1}{4}\sum _{m=1}^{\infty }\,{\frac {\zeta \left( 2\,m \right) \left( {4}^{m}-1 \right) \left( -1 \right) ^{m}}{m}} \end{aligned}\tag{11}$$ and after integrating $(10)$ once we know that: $$\ln \left( {\frac {\sin \left( z \right) }{z}} \right) =-\sum _{m=1}^ {\infty }\frac{\zeta \left( 2\,m \right)}{m} \left( {\frac {z}{\pi }} \right) ^{2\,m}\tag{12} $$ so by comparing $(11)$ with $(12)$ we know that: $$ \begin{aligned}\int _{0}^{\infty }\!{\frac { \sin^2 \left( x \right) }{x\sinh \left( x \right) }}{dx}&=\frac{1}{2}\,\ln\!\left( \frac{1}{2}\,{\frac {\sinh \left( 2\,\pi \right) }{\sinh \left( \pi \right) }} \right)\\ &=\frac{1}{2}\,\ln \left( \cosh \left( \pi \right) \right) \end{aligned}$$


For $I_2$, we can use a well-known result: $$ \int_{-\infty }^{\infty } \frac{\sinh (ax)}{\sinh(bx)}dx=\frac{\pi}{b}\tan\frac{a\pi}{2b}. $$ Note $\sinh(ix)=\sin(x), \tanh(ix)=\tan(x)$. Thus $$ \int_{-\infty }^{\infty } \frac{\sin (ax)}{\sinh(bx)}dx=\int_{-\infty }^{\infty } \frac{\sinh (iax)}{\sinh(bx)}dx=\frac{\pi}{b}\tanh\frac{a\pi}{2b}. $$ For $I_2$, define $$ I_2(a)=\int_{-\infty }^{\infty } \frac{\sin^2(ax)}{x\sinh (x)}dx. $$ Then $I_2(0)=0$ and $I_2(1)=I_2$. Now \begin{eqnarray} I_2'(a)&=&\int_{-\infty }^{\infty } \frac{2\sin(ax)\cos(ax)}{\sinh (x)}dx\\ &=&\int_{-\infty }^{\infty } \frac{\sin(2ax)}{\sinh (x)}dx\\ &=&\pi\tanh(a\pi). \end{eqnarray} So $$ I_2(1)=\int_0^1\pi\tan(a\pi)da=\ln(\cosh(a\pi)). $$