I am trying to find an approximation to

$$ I = \int_a^b \frac{1}{\sqrt{2 \pi \sigma^2}}e^{-(x-\mu)^2/2 \sigma^2}\log(1+e^{-x}) \ \ dx. $$ My attempt is as follows:

$$ \begin{align} I &= \int_a^b \frac{1}{\sqrt{2 \pi \sigma^2}}e^{-(x-\mu)^2/2 \sigma^2} \left( \sum_{i=1}^\infty \frac{e^{-ix}}{i} (-1)^{(i+1)} \right)\ dx\\ &= \sum_{i=1}^\infty \frac{(-1)^{(i+1)}}{i}\int_a^b \frac{1}{\sqrt{2 \pi \sigma^2}}e^{-(x-\mu)^2/2 \sigma^2} e^{-ix} \ \ dx\\ &= \sum_{i=1}^\infty \frac{(-1)^{(i+1)}}{i} k_i \int_a^b \frac{1}{\sqrt{2 \pi \sigma^2}}e^{-(x-(\mu-i \sigma^2))^2/2 \sigma^2} \ \ dx,\\ \end{align} $$ where

$$ k_i = e^{(\mu -i \sigma^2)^2-\mu^2}. $$ The $k_i$ increases exponentially with increasing $i$ and thus makes the sum divergent. I don't understand why this is happening although this sum should be finite (because I don't see any problem with the original integral).

P.S. I used MacLauren series in approximating natural logarithm.

  • $\begingroup$ The integrand is shrinking at the same time that $k_i$ is growing, right? The series expansion you've chosen should produce a convergent sum at least for $a>0$. $\endgroup$
    – mjqxxxx
    Jun 26, 2012 at 18:02
  • $\begingroup$ @mjqxxxx I don't know about the integrand. I actually summed it in MATLAB and I started to have $k_i$ equal to $\infty$ with quite lower values of $i$ and it messed up the sum. I will have to look into this. $\endgroup$
    – ubaabd
    Jun 26, 2012 at 19:47
  • $\begingroup$ Anybody notice it is formula for normal distribution? Can this be used to simplify?Must it be between 0 and 1 $\endgroup$
    – nanme
    Jun 28, 2012 at 2:10
  • 1
    $\begingroup$ The name is Maclaurin. $\endgroup$
    – Did
    Jul 4, 2012 at 17:37

2 Answers 2


For the expansion to make sense we need $e^{-x}<1$, so let's assume $0<a<b$.

If you do the remaining integral you'll find $$\begin{equation*} I = \sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n} \exp\left({-n \mu + \frac{1}{2}n^2\sigma^2}\right) \left( \mathrm{erf}\left(\frac{b-\mu+n\sigma^2}{\sqrt{2}\sigma}\right) - \mathrm{erf}\left(\frac{a-\mu+n\sigma^2}{\sqrt{2}\sigma}\right) \right),\tag{1} \end{equation*}$$ where $\mathrm{erf}$ is the error function. The summand may look badly behaved for large $n$ but the bad behavior is tamed by the asymptotic behavior of $\mathrm{erf}$. In fact, for large $n$ the summand goes like $$\begin{equation*} \frac{1}{\sqrt{2\pi}\sigma} \left[ \exp\left({-\frac{(b-\mu)^2}{2\sigma^2}}\right) \frac{(-1)^n e^{-n b}}{n^2} - \exp\left({-\frac{(a-\mu)^2}{2\sigma^2}}\right) \frac{(-1)^n e^{-n a}}{n^2} \right].\tag{2} \end{equation*}$$ Note that for $a>0$ the sum $\sum_n (-1)^n e^{-na}/{n^2}$ is absolutely convergent. This sum is related to the dilogarithm. For $(a-\mu+\sigma^2)/\sigma \gg 1$, the integral is well approximated by $$\begin{equation*} I\approx \frac{1}{\sqrt{2\pi}\sigma} \left[ \exp\left({-\frac{(b-\mu)^2}{2\sigma^2}}\right) \mathrm{Li}_2(-e^{-b}) - \exp\left({-\frac{(a-\mu)^2}{2\sigma^2}}\right) \mathrm{Li}_2(-e^{-a}) \right].\tag{3} \end{equation*}$$ In general you can cut the sum in (1) off at some appropriate $n$ dependent on your choice of the various parameters. The higher order terms are exponentially suppressed, so this should work quite well for a good choice of $n$.

enter image description here

Figure 1. Plot of $I(a)$ (solid) and the fit using $(3)$ (dashed) for $\mu=2$, $\sigma=4$, and $b=4$.

  • $\begingroup$ Thanks! That really helped ! $\endgroup$
    – ubaabd
    Jun 26, 2012 at 21:56
  • $\begingroup$ @Aitezaz: Glad to help. Cheers! $\endgroup$
    – user26872
    Jun 26, 2012 at 22:15

The increase of $k_i$ is compensated by decrease of the exponent in the integral, so the series is convergent.

  • $\begingroup$ I think Fubini's theorem can be shown to be applicable here, so this must be correct. $\endgroup$ Jun 26, 2012 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .