TITLE: How to handle the integral $\int_{0}^{\infty} \frac{\log(x)}{\sqrt{x^{3}}} e^{-\frac{1}{2b} \frac{(x-a)^{2}}{ax} } dx$
QUESTION [6 upvotes]: I have two integrals as parts of a bigger problem. One is,
$$
\int_{0}^{\infty}\frac{\log(x)}{\sqrt{x^{3}}}
\exp\left(-\frac{1}{2b} \frac{\left[x - a\right]^{\,2}}{ax}\right)\mathrm{d}x
$$
and another is similar,
$$
\int_{0}^{\infty}\frac{\left(x - a\right)^{2}}{x\sqrt{\,{x^{3}}\,}}
\exp\left(-\frac{1}{2b} \frac{\left[x - a\right]^{2}}{ax}\right) dx
$$
I have gotten only as far as simplifying the first one to,
$$
\mathrm{e}^{1/b}\int_{0}^{\infty}
\frac{\log(x)}{\sqrt{\,{x^{3}}\,}}
\exp\left(-\left[\frac{x}{2ab}+\frac{a}{2bx}\right]\right) dx
$$
which would also apply to the second one, but I am struggling to go any further.  Any hint on how to start about these would be greatly appreciated. If it helps, the exponential part of the integrals stems from the formula of differential entropy of the inverse Gaussian distribution.

REPLY [4 votes]: thanks for an interesting problem.
I'll call your integrals
$$
I_1 := \int_{0}^{\infty} \frac{\log(x)}{\sqrt{x^{3}}} e^{-\frac{1}{2b} \frac{(x-a)^{2}}{ax} } dx
$$
$$
I_2 := \int_{0}^{\infty} \frac{(x-a)^{2}}{x\sqrt{x^{3}}} e^{-\frac{1}{2b} \frac{(x-a)^{2}}{ax} } dx 
$$
We're going to solve the problem by introducing a master integral $J$, defined as
$$
J(c,d,n) := \int_{0}^{\infty} x^n e^{-c x - \frac{d}{x} } dx 
$$
Note that $J$ converges only for $c$ and $d$ positive.
By expanding the brackets in your intergrals as you were doing, we can see that
$$
I_1 = e^{\frac{1}{b}}\left(\frac{\partial}{\partial n}J(\frac{1}{2ab},\frac{a}{2b},n)\right)\bigg\rvert_{n=-\frac{3}{2}}
$$
and
$$
I_2 = e^{\frac{1}{b}}\left(J(\frac{1}{2ab},\frac{a}{2b},-\frac{1}{2})-2aJ(\frac{1}{2ab},\frac{a}{2b},-\frac{3}{2}) + a^2 J(\frac{1}{2ab},\frac{a}{2b},-\frac{5}{2})\right)
$$
So if we knew the functional form of the master integral $J(c,d,n)$ for all values of its parameters, then we would know both of your integrals. (We would also be able to calculate a lot of other integrals, and I suspect that many of these would be likely to be relevant to the inverse gaussian distribution too).
First let's look at the cases relevant to $I_2$. This integral is more simple.
To calculate $I_2$, we need to know the master integral for $n$ equal to $-\frac{1}{2}, -\frac{3}{2} $and $ -\frac{5}{2}$. To calculate the integral for these values we are going to first derive some functional relations for $J$, and then solve these functional relations.
To find the first relation, change variables in the definition of $J$ such that $y = \frac{d}{c x}$, noting that this gives $dy = -\frac{d}{cx^2}dx$. Under this transformation we see that
$$
J(c,d,n) = \left(\frac{d}{c}\right)^{n+1}\int_{0}^{\infty} y^{-n-2} e^{-\frac{d}{y} -c y} dy 
$$
This integral is of the same form as the definition of $J$, but with $n$ reflected and shifted. Then we see that
$$
J(c,d,n) = \left(\frac{d}{c}\right)^{n+1} J(c,d,-n-2)
$$
We'll also use two more relations. Differentiating under the integral sign with respect to $c$ we pull down an extra power of $x$, and hence.
$$
\frac{\partial}{\partial c}J(c,d,n) = -J(c,d,n+1)
$$
Finally if we set $c=0$, we can change variables to $y = \frac{1}{x}$ and then the integral is seen to be a gamma function integral,
$$
J(0, d, n) = \Gamma(-n-1)
$$
We now have enough relations to solve the master integral $J$ for the case $n =  -\frac{3}{2}$. From this we can also get the other values of $n$ that we need.
So start with the derivative relation
$$
\frac{\partial}{\partial c}J(c,d,-\frac{3}{2}) = -J(c,d,-\frac{1}{2})
$$
Now use the refecting and shifting relation to find that
$$
\frac{\partial}{\partial c}J(c,d,-\frac{3}{2}) = -\left(\frac{d}{c}\right)^{1/2} J(c,d,-\frac{3}{2})
$$
This is now a simple ODE that we can solve for $J(c,d,-\frac{3}{2})$. We find that
$$
J(c,d,-\frac{3}{2}) = J(0,d,-\frac{3}{2})e^{-2\sqrt{cd}}
$$
The initial value we know is $\Gamma(\frac{1}{2}) = \sqrt{\pi}$, and hence
$$
J(c,d,-\frac{3}{2}) = \sqrt{\pi}e^{-2\sqrt{cd}}
$$
From this value of $J(c,d,-\frac{3}{2})$, we can also now calculate $J(c,d,-\frac{1}{2})$ and $J(c,d,-\frac{5}{2})$. From the master integral expression we see they're related to $J(c,d,-\frac{3}{2})$ by differentiating with respect to $c$ and $d$ respectively. So just differentiate our result for $J(c,d,-\frac{3}{2})$ to arrive at
$$
J(c,d,-\frac{5}{2}) = \sqrt{\frac{\pi c}{d}}e^{-2\sqrt{cd}}
$$
$$
J(c,d,-\frac{1}{2}) = \sqrt{\frac{\pi d}{c}}e^{-2\sqrt{cd}}
$$
So now you have all of the necessary pieces, and you can put together your integral $I_2$ from the different expressions I've given here.
No let's spend a little bit of time to think about the other integral $I_1$. This one is quite a bit more complicated because of the $log$. The techniques that I used to calculate the integral $I_2$ can't be used in this case; they only work for discrete values of the parameter $n$, and to calculate your the first integral from $J(c,d,n)$ it's necessary to know the parameter $n$ continuously so we can differentiate with respect to it.
Actually I'm not sure how you solve the master integral for all values of $n$, but luckily Mathematica does know. It tells me that
$$
J(c,d,n) = 2 c^{\frac{1}{2} (-n-1)} d^{\frac{n+1}{2}} K_{-n-1}\left(2 \sqrt{c d}\right)
$$
Where $K$ is the Bessel K function.
You can then calculate your first integral by differentiaing with respect to $n$. Mathematica tells me that this is
$$
\left(\frac{\partial}{\partial n}J(c,d,n)\right)\bigg\rvert_{n=-\frac{3}{2}} = \frac{1}{2}\sqrt[4]{\frac{c}{d}}\left(\frac{\sqrt{\pi } e^{-2 \sqrt{c d}} (\log d -\log c )}{\sqrt[4]{cd}}-4 \text{BesselK}^{(1,0)}\left(\frac{1}{2},2 \sqrt{c d}\right)\right)
$$
What it means by $\text{BesselK}^{(1,0)}\left(\frac{1}{2},2 \sqrt{c d}\right)$ is that you have to differentiate the Bessel K function with respect to its parameter, and then evaluate that at $1/2$, with its argument equatl to $2 \sqrt{c d}$.