# Integration of product of exponential function and natural logarithm

I am trying to calculate the following integral:

$$\int_{-1}^{1}\ln(1+\gamma x)\exp\left(-\frac{(z-x)^2}{2}\right)dx$$

with $$\gamma\in[-1,1]$$, $$z\in\mathbb{R}$$ and ln being the natural logarithm. I tried a lot of thinks like substitution, integration by parts, used the series expansion of the natural logarithm resp of the exponential function. I also searched for some help in Literatur but couldn't find anything helpful. My question is: Can we solve this integral?

• Even for $\gamma=0$ you have a sum of $\textrm{erf}$ functions. So I doubt that you will have a nice analytical result. You can solve it numerically – Andrei Dec 28 '20 at 15:33
• @Andrei , for $\gamma = 0$ the integrand is 0. gimpfel, are you looking for a closed form answer? or is an infinite series representation enough? – Tom Ariel Dec 28 '20 at 15:41
• @TomAriel Oops. Sorry, my mistake.$\ln(1)\ne 1$, not even after Christmas :) – Andrei Dec 28 '20 at 15:43
• @TomAriel do you have an idea about an infinite series representation ? – gimpfel Dec 29 '20 at 20:20
• @gimpfel If an answer was helpful to you, please don't forget to 'accept' it, so this question is marked as resolved. – Sal Feb 1 at 14:04

Considering first the restricted problem with $$z=0$$.

We can find an approximate series for $$\gamma\rightarrow 0$$. First, expand the logarithm

$$\ln(1+\gamma x)=\gamma x - \frac{(\gamma x)^2}{2}+ ...$$

Now notice that on the integration domain, all terms $$x^{odd}$$ will integrate to zero. We are left with

$$I(\gamma)=-\int_{-1}^{1}dx\ \left( \frac{(\gamma x)^2 }{2}+ \frac{(\gamma x)^4 }{4}+... \right)e^{-x^2/2}$$

Term by term integration gives

$$I(\gamma)\sim\sum_{n=1}^\infty A_n \gamma^{2n}, \ \gamma\rightarrow 0$$

With the coefficients

$$A_n =-\frac{2^{n-1/2}}{n}\left( \Gamma(n+1/2)-\Gamma(n+1/2,1/2) \right)$$

The degree to which this is an improvement depends on how you feel about the incomplete gamma function. By repeated use of the identities

$$\Gamma(s+1,x)=s \Gamma(s,x)+x^s e^{-x}$$

$$\Gamma(1/2,x)=\sqrt{\pi} \operatorname{erfc}(\sqrt{x})$$

Every term in the series may be cast into the form of $$\operatorname{elementary function} \times \operatorname{erfc}(2^{-1/2})$$. This is an improvement because now all those $$\operatorname{erfc}$$s appear as constants in the series. The first term alone is a fine approximation

$$I(\gamma)\sim -\gamma^2 \left(\sqrt{\pi/2} \left( 1-\operatorname{erfc}(2^{-1/2})\right)-e^{-1/2} \right),\gamma\rightarrow0$$

More importantly we learn that for small $$\gamma$$, the integral scales as $$-\gamma^2$$.

Here is a plot of the first term together with the exact (numerically integrated) result

And the same plot with just three terms

We can also (somewhat) extend this to the case $$z\rightarrow 0$$.

To avoid issues of non-uniform convergence, I'll consider the integral

$$I(\epsilon)= \int_{-1}^1 \ dx \ln(1+\gamma \epsilon x) \exp \left(-\frac{(x-\epsilon z)^2}{2}\right)$$

This of course is still restricted compared to the original. Expanding the exponential around $$\epsilon=0$$ will produce a series of 'corrections' to the $$\ln$$ series. The first nonzero term still occurs at $$\epsilon^2$$. I find

$$I(\epsilon)\sim -\epsilon^2 \frac{\gamma(\gamma-2z)}{2\sqrt{e}}\left( \sqrt{2e\pi} \operatorname{erf}(2^{-1/2})-2\right),\epsilon\rightarrow 0$$

We learn the integral scales with $$-\gamma(\gamma-2z)$$ for small $$\epsilon$$. Here's a plot with $$\gamma=1/2$$

As expected, when $$z>1$$ the approximation is bad: this is when the peak of the Gaussian passes outside of the integral bounds.

For large $$z$$, I think we should be able to write the exponential in such a way as to use Laplace's method, but I don't see how right now.

$$I=\int\log(1+\gamma x)\,\exp\left(-\frac{(z-x)^2}{2}\right)dx$$

Let $$x=\sqrt{2} t+z$$ to make $$I=\sqrt{2}\int \log \big[1+\gamma \left(\sqrt{2} t+z\right)\big]\,e^{-t^2}\,dt$$ Using Taylor around $$t=0$$ $$\log \big[1+\gamma \left(\sqrt{2} t+z\right)\big]=\log (1+\gamma z)-\sum_{n=1}^\infty \frac{2^{n/2} \left(-\frac{\gamma }{\gamma z+1}\right)^n}{n} t^n$$ and $$J_n=\int t^n\,e^{-t^2}\,dt=-\frac{1}{2} \Gamma \left(\frac{n+1}{2},t^2\right)$$

This would be a nightmare.