Integral related to the softplus function

improper-integralsintegrationlogarithmspolylogarithm

Let
$$
f(x) = \log(1+e^{2x+1}) – 2\log(1 + e^{2x}) + \log(1 + e^{2x-1}).
$$

According to Wolfram Alpha,
$$
\int_{-\infty}^\infty f(x)\,dx = \frac 12.\tag{$*$}
$$

$f(x)$ is a "bump function" built out of the softplus function $y=\log(1 + e^x)$, that I want to use as a kernel for nonparametric regression. I want to normalize $f(x)$ to have integral $1$, and the definite integral (*) gives the normalizing factor.

But I can't figure out how to do the integral by hand.
Substitution gives (and Wolfram Alpha confirms)
$$
\int f(x)\,dx
= \operatorname{Li}_2(-e^{2x}) – \frac12\operatorname{Li}_2(-e^{2x-1})
– \frac12\operatorname{Li}_2(-e^{2x+1}) + C,
$$

where $\operatorname{Li}_2(x)$ is the dilogarithm function. I haven't had any success in applying dilogarithm identities to the above, though.

Can anyone give a derivation of $(*)$?

Best Answer

Equal to $I(1/2)$ where, for real $a>0$, \begin{align}I(a)&=\int_{-\infty}^{\infty}\log\frac{\cosh(x+a)\cosh(x-a)}{\cosh^2 x}\,dx\\&=\int_{-\infty}^{\infty}\int_{0}^{a}\left(\tanh(x+y)-\tanh(x-y)\right)\,dy\,dx\\&=\int_{0}^{a}\left.\log\frac{\cosh(x+y)}{\cosh(x-y)}\right|_{x=-\infty}^{x=\infty}\,dy=4\int_{0}^{a}y\,dy=2a^2.\end{align}