Integral related to the softplus function

404 Views Asked by At

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 $(*)$?

2

There are 2 best solutions below

0
On 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}

0
On

$$I=\int_{-\infty}^\infty \ln\left(\frac{(1+e^{2x}\cdot e)(1+e^{2x}/e)}{(1+e^{2x})^2}\right)dx\overset{e^{2x}\to x}=\frac12 \int_0^\infty\ln\left(\frac{(1+ex)(1+x/e)}{(1+x)^2}\right)\frac{dx}{x} $$ $$\overset{IBP}=\frac12\int_0^\infty \ln x \left(\frac{1}{1+x}-\frac{1}{e+x}\right)dx+\frac12\int_0^\infty \ln x \left(\frac{1}{1+x}-\frac{e}{1+ex}\right)dx$$

$$\int_0^\infty \ln x \left(\frac{1}{1+x}-\frac{e}{1+ex}\right)dx\overset{x\to \frac{1}{x}}=\int_0^\infty \ln x \left(\frac{1}{1+x}-\frac{1}{e+x}\right)dx$$ $$\Rightarrow I=\int_0^\infty \ln x \left(\frac{1}{1+x}-\frac{1}{e+x}\right)dx\overset{x\to \frac{e}{x}}=\int_0^\infty \ln \left(\frac{e}{x}\right) \left(\frac{1}{1+x}-\frac{1}{e+x}\right)dx$$

Summing up the two integrals from above gives: $$2I=\int_0^\infty \left(\frac{1}{1+x}-\frac{1}{e+x}\right)dx\Rightarrow I=\frac12 \ln\left(\frac{1+x}{e+x}\right)\bigg|_0^\infty=\frac12$$