6

How do you solve this integral involving the Cauchy principal value?

$$ \mathcal{P} \int_{-\infty}^{\infty} \frac{\tanh(x+a)-\tanh(x+b)}{x} dx \\ = \int_0^\infty \frac{\tanh(x+a)+\tanh(x-a)-\tanh(x+b)-\tanh(x-b)}{x} dx $$

The integral converges as the tail decays exponentially, and at $x=0$ it is a removable singularity. What would be a good approach to tackle this? I am reluctant to use the residue theorem as there are too many poles. Perhaps the result of this integral can be expressed using some special functions? If it helps, this integral arose from a Fourier transform.

Edit 1:

After numerically verifying Mariusz Iwaniuk's answer the question boils down to showing $$ \mathcal{P} \int_{-\infty}^{\infty} \frac{\tanh(x+a)-\tanh(x)}{x} dx \\ = 2\psi\left(\frac{1}{2}\right) - \psi\left(\frac{1}{2} + i\frac{a}{\pi}\right) - \psi\left(\frac{1}{2} - i\frac{a}{\pi}\right) $$

Edit 2:

Thanks all for the help. Using the method outlined below, I solved another similar integral and I thought it would be useful to leave it here for future reference.

$$ \int_{-\infty}^\infty \frac{\tanh(x-a)-\tanh(x+a)+2\tanh(a)}{x^2} dx = \frac{2i}{\pi} \left[ \psi_1\left(\frac{1}{2}+\frac{ia}{\pi}\right) - \psi_1\left(\frac{1}{2}-\frac{ia}{\pi}\right) \right] $$

Bio
  • 1,198

3 Answers3

4

Similar to the solution by @Random Variable

Let's consider a bit more general form $$I(a,b,c)=\int_0^\infty \Big(\tanh(x+a)+\tanh(x-a)-\tanh(x+b)-\tanh(x-b)\Big)\frac x{x^2+c^2}dx$$ then the desired integral $\,\displaystyle I_0=I(a, b, c=0)$

Integrating by parts $$I(a,b,c)=$$ $$=\frac12\int_0^\infty\ln(x^2+c^2)\left(\frac1{\cosh^2(x+b)}+\frac1{\cosh^2(x-b)}-\frac1{\cosh^2(x+a)}-\frac1{\cosh^2(x-a)}\right)dx$$ $$=\frac14\int_{-\infty}^\infty\ln(x^2+c^2)\left(\frac1{\cosh^2(x+b)}+\frac1{\cosh^2(x-b)}-\frac1{\cosh^2(x+a)}-\frac1{\cosh^2(x-a)}\right)dx$$ Now we can handle every integral separately. Let's take, for example $$J(a,c)=\frac14\int_{-\infty}^\infty\frac{\ln(x^2+c^2)}{\cosh^2(x+a)}dx=\frac\pi4\int_{-\infty}^\infty\frac{2\ln\pi+\ln(t^2+\frac{c^2}{\pi^2})}{\cosh^2(\pi t+a)}dt$$ $$\frac{\ln \pi}2+\frac\pi 2\Re\,\int_{-\infty}^\infty\frac{\ln(\frac c\pi-it)}{\cosh^2(\pi t+a)}dt$$ Using the fact that $\cosh^2(\pi (t+i)+a)=\cosh^2(\pi t+a)$, and $\,\ln(\frac c\pi-it)=\ln\Gamma(\frac c\pi-it+1)-\ln\Gamma(\frac c\pi-it)=\ln\Gamma(\frac c\pi-i(t+i))-\ln\Gamma(\frac c\pi-it)$ we can present the last integral as a contour integral along the rectangular contour $C$ : $-R\to R\to R+i\to -R+i\to -R$: $$J(a,c)=\frac{\ln \pi}2-\frac\pi 2\Re\,\oint_C\frac{\ln\Gamma(\frac c\pi-iz)}{\cosh^2(\pi z+a)}dz=\frac{\ln \pi}2-\frac\pi2\Re\Big(2\pi i\underset{z=\frac i2-\frac a\pi}{\operatorname{Res}}\frac{\ln\Gamma(\frac c\pi-iz)}{\cosh^2(\pi z+a)}\Big)$$ $$=\frac{\ln \pi}2+\Re\,\Psi\Big(\frac12+\frac c\pi+i\frac a\pi\Big)$$ $$I(a,b,c)=2\,\Re\,\left(\Psi\Big(\frac12+\frac c\pi+i\frac b\pi\Big)-\Psi\Big(\frac12+\frac c\pi+i\frac a\pi\Big)\right)$$ Putting $c=0$, we get the result presented by @Mariusz Iwaniuk and @Random Variable

Svyatoslav
  • 20,502
3

Assume that $a$ and $b$ are positive parameters.

Let $\psi(z)$ be the digamma function, which obeys the functional equation $\psi(z) - \psi(z+1) = -\frac{1}{z}$ and has the Laurent series expansion $\psi(z) = - \frac{1}{z} + O(1)$.

Similar to Setness Ramesory's answer here, we can integrate the function $$f(z) = \psi \left(\frac{z}{i \pi} \right) \left(\tanh(z+a) - \tanh(z+b) \right)$$ around a rectangular contour, indented at the origin, with vertices at $\pm R, \pm R + i \pi$.

Letting the radius of the indentation go to zero, and then combining the integral along the bottom of the contour with the integral along the top of the contour, we get $$ -i \pi \operatorname{PV} \int_{-R}^{R} \frac{\tanh(x+a)- \tanh(x+b)}{x} \, \mathrm dx - i \pi \operatorname*{Res}_{z=0} f(z). $$

(The functional equation of the digamma function was used above, along with the fact that $\tanh(z)$ is $\pi$-periodic in the imaginary direction.)

As $R \to \infty$, the integrals of the left and right sides of the contour vanish because the magnitude of $f(z)$ decays exponentially to zero as $\Re(z) \to \pm \infty$.

Therefore, we have $$ \begin{align} \lim_{(\epsilon \to 0,R \to \infty)} \oint f(z) \, \mathrm dz &= - i \pi \operatorname{PV} \int_{-\infty}^{\infty} \frac{\tanh(x+a)- \tanh(x+b)}{x} \, \mathrm dx - i \pi \operatorname*{Res}_{z=0} f(z) \\ &= 2 \pi i \left(\operatorname*{Res}_{z=-a+i \pi/2}f(z) + \operatorname*{Res}_{z=-b+i \pi/2}f(z)\right), \end{align}$$

where $$ \begin{align} \operatorname*{Res}_{z=-a + i \pi/2}f(z) &= \operatorname*{Res}_{z \to -a + i \pi/2} \psi \left(\frac{z}{i \pi} \right) \tanh(z+a) \\ &= \lim_{z \to -a + i \pi/2} \frac{\psi (\tfrac{z}{i \pi} )\sinh(z+a)}{\frac{\mathrm d}{\mathrm dz}\cosh(z+a)} \\ &= \psi \left(\frac{1}{2} + \frac{ia}{\pi} \right) \end{align}$$

and $$\operatorname*{Res}_{z=0}f(z) = - i \pi \left(\tanh(a) - \tanh(b) \right). $$

(The other poles of $\psi \left(\frac{z}{i \pi} \right)$ are in the lower half-plane.)

It then follows that $$\begin{align} &\operatorname{PV} \int_{-\infty}^{\infty}\frac{\tanh(x+a)- \tanh(x+b)}{x} \, \mathrm dx \\ &= -\frac{1}{i \pi} \left(i \pi (-i \pi) \left(\tanh(a) - \tanh(b) \right) + 2 \pi i \left(\psi \left(\frac{1}{2} + \frac{ia}{\pi} \right) - \psi \left(\frac{1}{2} + \frac{ib}{\pi} \right) \right) \right) \\ &= 2 \psi \left(\frac{1}{2} + \frac{ib}{\pi} \right)-2 \psi \left(\frac{1}{2} + \frac{ia}{\pi} \right) + i \pi \left(\tanh(a) - \tanh(b) \right) \\& \overset{\clubsuit}{=} \psi \left(\frac{1}{2} + \frac{ib}{\pi} \right) + \psi \left(\frac{1}{2} - \frac{ib}{\pi} \right) -\psi \left(\frac{1}{2} + \frac{ia}{\pi} \right) -\psi \left(\frac{1}{2} - \frac{ia}{\pi} \right) . \end{align}$$


$\clubsuit$ Reflection formula for the digamma function.


Alternatively, we could integrate $$g(z) = \frac{1}{2} \, \psi \left(\frac{z}{i \pi} \right) \left(\tanh(z+a)+\tanh(z-a)-\tanh(z+b)-\tanh(z-b) \right) $$ around the same contour but without an indentation at the origin.

And to evaluate the more general integral $I(a,b,c)$ in Svyatoslav's answer, we could integrate $$h(z) = \frac{1}{2} \, \psi \left(\frac{z+ic}{i \pi} \right) \left(\tanh(z+a)+\tanh(z-a)-\tanh(z+b)-\tanh(z-b) \right).$$

  • 1
    Thanks for the detailed answer. A note to self regarding the reflection formula: $\psi(\frac{1}{2}+x) - \psi(\frac{1}{2}-x) = \pi \tan \pi x$ – Bio Jul 15 '24 at 07:26
2

This is not an answer really, only a solution from $\tt Mathematica$: $$ \mathcal{P} \int_{-\infty}^{\infty} \frac{\tanh(x+a)-\tanh(x+b)}{x} dx =\\-H_{-\frac{1}{2}-\frac{i a}{\pi }}-H_{-\frac{1}{2}+\frac{i a}{\pi }}+H_{-\frac{1}{2}-\frac{i b}{\pi }}+H_{-\frac{1}{2}+\frac{i b}{\pi }}=\\-\psi\left(\frac{1}{2}-\frac{i a}{\pi }\right)-\psi \left(\frac{i a}{\pi }+\frac{1}{2}\right)+\psi\left(\frac{1}{2}-\frac{i b}{\pi }\right)+\psi\left(\frac{i b}{\pi }+\frac{1}{2}\right)$$

where: $H$ is Harmonic Number function and $\psi$ is PolyGamma function.

$\tt Mathematica$ code to compute integral:

F = Sqrt[2 Pi]*InverseFourierTransform[
InverseFourierTransform[
  1/E^(-I s x)*FourierTransform[Tanh[x + a]/x, a, s], x, z] /. 
 z -> s, s, a] - 
Sqrt[2 Pi]*InverseFourierTransform[
InverseFourierTransform[
  1/E^(-I s x)*FourierTransform[Tanh[x + b]/x, b, s], x, z] /. 
 z -> s, s, b] // Simplify

F /. a -> 5 /. b -> 3 // N (-1.10055 + 0. I)