<s>[INST] Definite integration $\int _{-\infty}^\infty \frac{\tan^{-1}(2x-2)}{\cosh(\pi x)}dx$ How do I integrate $$\int _{-\infty}^\infty \frac{\tan^{-1}(2x-2)}{\cosh(\pi x)}dx\quad ?$$
The actual integral that I encountered is:
$$\int_{-\infty}^\infty dx \left(\frac{N}{\cosh(\frac{\pi }{c}(x-1))}+\frac{1}{\cosh(\frac{\pi}{c}x)} \right) 2 \tan^{-1}\left(\frac{2x-2}{c} \right)$$ where c is a constant with $$\Re c>0$$ Not sure if these two terms makes it easier.
I was trying to solve just the last term, but I couldn't make any progress. Numerical integration gives $\int _{-\infty}^\infty \frac{\tan^{-1}(2x-2)}{\cosh(\pi x)}dx= -1.01334 $. Any hint on how to do it analytically?
 [/INST] 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.
</s>