Definite integration $\int _{-\infty}^\infty \frac{\tan^{-1}(2x-2)}{\cosh(\pi x)}dx$

For $a>0$ and $b\in \mathbb{R}$, $$\tag{*}\color{blue}{\int_{ - \infty }^\infty {\frac{{\arctan (ax + b)}}{{\cosh \pi x}}dx} = 2\Im\left[ \log\Gamma(\frac{3}{4}+\frac{i (b-i)}{2 a})- \log\Gamma(\frac{1}{4}+\frac{i (b-i)}{2 a})\right]}$$ Here, $\log\Gamma$ is the log gamma function.


To begin, assume $\Im(c)>0, \Re(s)<0, \xi\in \mathbb{R}$, we have the following Fourier transform (hold pointwise except possibly for $\xi=0$): $$\int_{ - \infty }^\infty {{{(x + c)}^s}{e^{ - 2\pi ix\xi }}dx} = \frac{{{e^{\pi is/2}}}}{{\Gamma ( - s){{(2\pi )}^s}}}{\xi ^{ - s - 1}}{e^{2\pi ic\xi }}{\chi _{(0,\infty )}}(\xi )$$ this can be proved by shifting the path of integration using a parallelogram, then use the result for $\int_0^\infty x^s \exp(-2\pi i x\xi) dx$. Here $\chi_A$ is the characteristic function for set $A$.

Fourier transform of $\text{sech } \pi x$ is itself, Plancherel theorem implies $$\int_{ - \infty }^\infty {\frac{{{{(x + c)}^s}}}{{\cosh \pi x}}dx} = \frac{{{e^{\pi is/2}}}}{{\Gamma ( - s){{(2\pi )}^s}}}\int_0^\infty {\frac{{{x^{ - s - 1}}{e^{2\pi icx}}}}{{\cosh \pi x}}dx} $$ this holds only for $\Re(s)<0$, a minor modification will make it holds for $\Re(s)<2$: $$\int_{ - \infty }^\infty {\frac{{{{(x + c)}^s}}}{{\cosh \pi x}}dx} = \frac{{{e^{\pi is/2}}}}{{\Gamma ( - s){{(2\pi )}^s}}}\int_0^\infty {{x^{ - s - 1}}{e^{2\pi icx}}(\frac{1}{{\cosh \pi x}} - 1)dx} +(-ic)^s e^{\pi i s/2} $$

Differentiate both sides with respect to $s$, then put $s=0$ yields $$\tag{1}\int_{ - \infty }^\infty {\frac{{\log (x + c)}}{{\cosh \pi x}}dx} = - \int_0^\infty {\frac{{{e^{2cix}}}}{x}(\frac{1}{{\cosh x}} - 1)dx} + \log c \qquad \Im(c)>0$$


We claim that $$\tag{2}\int_0^\infty {\frac{{{e^{ - 2cx}}}}{x}(\frac{1}{{\cosh x}} - 1)dx} = \log \frac{c}{2} + 2\log \Gamma (\frac{1}{4} + \frac{c}{2}) - 2\log \Gamma (\frac{3}{4} + \frac{c}{2}) \qquad c>0$$

It is not difficult to show the Laplace transform of $\text{sech }x$ is $\frac{1}{2} (\psi(\frac{s+3}{4})-\psi(\frac{s+1}{4}))$, therefore, by a property of Laplace transform, $$\int_0^\infty {\frac{{{e^{ - 2cx}}}}{x}(\frac{1}{{\cosh x}} - 1)dx} = \int_{2c}^\infty {\left[ { - \frac{1}{s} + \frac{1}{2}\left( { - \psi (\frac{{1 + s}}{4}) + \psi (\frac{{3 + s}}{4})} \right)} \right]ds} $$

because $\int \psi(x)dx = \log\Gamma(x)$, $$\small \int_{2c}^R {\left[ { - \frac{1}{s} + \frac{1}{2}\left( { - \psi (\frac{{1 + s}}{4}) + \psi (\frac{{3 + s}}{4})} \right)} \right]ds} = \log (2c) - \log R + 2\log \frac{{\Gamma (\frac{1}{4} + \frac{c}{2})\Gamma (\frac{{3 + R}}{4})}}{{\Gamma (\frac{3}{4} + \frac{c}{2})\Gamma (\frac{1+R}{4})}}$$

making $R\to \infty$ proves $(2)$.


Combining $(1), (2)$ and analytic continuation shows, $$\int_{ - \infty }^\infty {\frac{{\log (x{c^{ - 1}} + 1)}}{{\cosh \pi x}}dx} = 2\log \Gamma (\frac{3}{4} - \frac{{ci}}{2}) - 2\log \Gamma (\frac{1}{4} - \frac{{ci}}{2}) - \log \frac{c}{2} + \frac{\pi }{2}i\qquad \Im(c)>0$$ Taking complex conjugation both sides $$\int_{ - \infty }^\infty {\frac{{\log (x{c^{ - 1}} + 1)}}{{\cosh \pi x}}dx} = 2\log \Gamma (\frac{3}{4} + \frac{{ci}}{2}) - 2\log \Gamma (\frac{1}{4} + \frac{{ci}}{2}) - \log \frac{c}{2} - \frac{\pi }{2}i\qquad \Im(c)<0$$

WLOG, assume $a>0$, then $$\int_{ - \infty }^\infty {\frac{{\arctan (ax + b)}}{{\cosh \pi x}}dx} = \Im \left[ {\int_{ - \infty }^\infty {\frac{{\log (\frac{{ia}}{{1 + bi}}x + 1)}}{{\cosh \pi x}}dx} + \log (1 + bi)} \right]$$ (some arguments are needed to justify the separation of $\log$), so after some simplification we have $(*)$.


Assume $a>0$ and $b \in \mathbb{R}$.

Let's first make the substitution $u = ax+b$ to get $$\int_{-\infty}^{\infty} \frac{\arctan (ax+b)}{\cosh(\pi x)} \, \mathrm dx = \int_{-\infty}^{\infty} \frac{\arctan u}{a\cosh \left(\pi \left(\frac{u-b}{a} \right) \right)} \, \mathrm du.$$

Following the general approach that Iaroslav V. Blagouchine uses in the paper Rediscovery of Malmsten’s integrals, their evaluation by contour integration methods and some related results, let's integrate the function $$\frac{\log \Gamma \left(\frac{z}{2ia}+\frac{1}{2a} \right)}{a\cosh\left(\pi \left(\frac{z-b}{a} \right) \right)}, $$ where $\log \Gamma (z)$ is the log-gamma function, around an infinitely wide rectangular contour in the upper half of the complex plane of height $2ia $ (which is the period of the denominator).

(The branch cut for the log-gamma function in the numerator runs down the imaginary axis from $z=-i$, and the denominator grows much faster than the numerator as $\Re(z) \to \pm \infty$.)

Integrating around the contour, and using the property $\log(x) + \log \Gamma(x) = \log \Gamma(x+1)$, we get $$\begin{align} &\int_{-\infty}^{\infty} \frac{\log \Gamma \left(\frac{x}{2ia }+\frac{1}{2a} \right)}{a\cosh\left(\pi \left(\frac{x-b}{a} \right) \right)} \, \mathrm dx -\int_{-\infty}^{\infty} \frac{\log \Gamma \left(\left(\frac{x}{2ia }+\frac{1}{2a} \right)+1 \right)}{a\cosh\left(\pi \left(\frac{x-b}{a} \right) \right)} \, \mathrm dx \\ &= -\int_{-\infty}^{\infty} \frac{\log \left(\frac{x}{2ia}+\frac{1}{2a} \right)}{a\cosh\left(\pi \left(\frac{x-b}{a} \right) \right)} \, \mathrm dx \\ &= 2 \pi i \left(\operatorname{Res} \left[f(z), b+ \frac{ia}{2} \right] + \operatorname{Res} \left[f(z), b+ \frac{3ia}{2}\right] \right) \\ &= 2 \pi i \left(\frac{1}{\pi i} \, \log \Gamma\left(\frac{1}{4}+ \frac{1}{2a} -\frac{ib}{2a} \right) - \frac{1}{\pi i} \, \log \Gamma \left(\frac{3}{4}+ \frac{1}{2a} - \frac{ib}{2a} \right)\right) \\&= 2 \left( \log \Gamma\left(\frac{1}{4}+ \frac{1}{2a} - \frac{ib}{2a} \right) - \log \Gamma \left(\frac{3}{4}+ \frac{1}{2a}- \frac{ib}{2a} \right) \right). \end{align}$$

Then equating the imaginary parts on both sides of the equation, we get $$\int_{-\infty}^{\infty} \frac{\arctan x}{a\cosh\left(\pi \left(\frac{x-b}{a} \right) \right)} \, \mathrm dx = 2 \Im \left( \log \Gamma\left(\frac{1}{4}+ \frac{1}{2a} - \frac{ib}{2a} \right) - \log \Gamma \left(\frac{3}{4}+ \frac{1}{2a} - \frac{ib}{2a} \right)\right). $$

By the Schwarz reflection principle, the result can also be expressed as $$2 \Im \left( \log \Gamma\left(\frac{3}{4}+ \frac{1}{2a} + \frac{ib}{2a} \right) - \log \Gamma \left(\frac{1}{4}+ \frac{1}{2a} + \frac{ib}{2a} \right)\right),$$ which agrees with pisco's answer.


Since we have the trivial representations $\displaystyle \int_0^{\infty }\left(\int_0^{\infty } \sin ((2 x-2) y) e^{-y (1+z)}\textrm{d}z\right)\textrm{d}y=\arctan(2x-2)$ and then $\displaystyle \int_{-\infty }^{\infty } \frac{\sin ((2 x-2) y)}{\cosh (\pi x)} \textrm{d}x=-\frac{\sin(2 y)}{\cosh(y)}$, we arrive at $$\mathcal{I}=-\int_0^{\infty}\left(\int_0^{\infty}\frac{\sin(2 y)}{\cosh(y)} e^{-(1+z)y} \textrm{d}y\right)\textrm{d}z,$$ where expanding $\operatorname{sech}(y)$ in series, integrating with respect to $y$ and identifying the polygammas with a complex argument, we have $$\mathcal{I}= \int_0^{\infty}\left(-\frac{1}{4} i \psi ^{(0)}\left(1+\frac{i}{2}+\frac{z}{4}\right)+\frac{1}{4} i \psi ^{(0)}\left(\frac{1}{2}+\frac{i}{2}+\frac{z}{4}\right)+\frac{1}{4} i \psi ^{(0)}\left(1-\frac{i}{2}+\frac{z}{4}\right)-\frac{1}{4} i \psi ^{(0)}\left(\frac{1}{2}-\frac{i}{2}+\frac{z}{4}\right)\right)\textrm{d}z=i \log \left(\frac{\displaystyle\Gamma \left(\frac{1}{2}-\frac{i}{2}\right) \Gamma \left(1+\frac{i}{2}\right)}{\displaystyle \Gamma \left(\frac{1}{2}+\frac{i}{2}\right) \Gamma \left(1-\frac{i}{2}\right)}\right),$$ where the last integration is trivially developed by using negapolygamma function.

End of story