TITLE: How to calculate $\int_{0}^{\infty} x^{-x} \,dx$?
QUESTION [5 upvotes]: I am trying to solve this improper integral: $\int_{0}^{\infty} x^{-x} \,dx$.
First I replace de infinity by a another variable $y$, so:
$\int_{0}^{y} x^{-x} \,dx = \int_{0}^{y} e^{\ln(x^{-x})}\,dx = \int_{0}^{y} e^{-x\ln(x)}\,dx = \int_{0}^{y} \sum_{n=0}^{\infty} \frac{(-x\ln(x))^{n}}{n!}\,dx = \sum_{n=0}^{\infty} \frac{(-1)^{n}}{n!} \int_{0}^{y} (x\ln(x))^n\, dx$.
Solving $\int (x\ln(x))^n\,dx$:

Substitute $u=\ln(x) \implies \int u^ne^{(n+1)n}\,du $
Substitute $v=u^{n+1} \implies \frac{1}{n+1}\int e^{(n+1)v^{\frac{1}{n+1}}}\,dv$
Substitute $w=(n+1)^{(n+1)}v  \implies \int e^{(n+1)v^{\frac{1}{n+1}}}\,dv = (n+1)^{-n-1}\int e^{w^{\frac{1}{n+1}}}\,dw$
$\int e^{w^{\frac{1}{n+1}}}\,dw = -(n+1)(-1)^n \operatorname{\Gamma}(n+1,-w^{\frac{1}{n+1}})$
Undo substitutions, $\int (x\ln(x))^n\,dx = \dfrac{\left(n+1\right)^{-n-1}\operatorname{\Gamma}\left(n+1,-\left(n+1\right)\ln\left(x\right)\right)}{\left(-1\right)^n}$
$\int_{0}^{y} (x\ln(x))^n\, dx  \implies \dfrac{\left(n+1\right)^{-n-1}\operatorname{\Gamma}\left(n+1,-\left(n+1\right)\ln\left(x\right)\right)}{\left(-1\right)^n}  \Big|_0^y$, when $x=0$, the incomplete gamma function will be evalueate between plus infinity and plus infinity so, $\int_{0}^{y} (x\ln(x))^n\, dx =  \dfrac{\left(n+1\right)^{-n-1}\operatorname{\Gamma}\left(n+1,-\left(n+1\right)\ln\left(y\right)\right)}{\left(-1\right)^n}$
$\sum_{n=0}^{\infty} \frac{(-1)^{n}}{n!} \int_{0}^{y} (x\ln(x))^n\, dx = \sum_{n=0}^{\infty} \frac{\operatorname{\Gamma}\left(n+1,-\left(n+1\right)\ln\left(y\right)\right)}{n!(n+1)^{n+1}} =   \sum_{n=1}^{\infty}\frac{Q\left(n,\ -n\ln\left(y\right)\right)}{n^n}$.

Where $Q$ is the normalized or regularized incomplete gamma function
But what's happen when $y \to \infty$? The incomplete gamma function will be evaluated between zero and minus infinity, is it valid? Is there another way to find this value? Because de the improper integral converges.

REPLY [2 votes]: Using the known identities
$$\int\limits_0^1\ln^n z\,\text dz = (-1)^n n!,\tag1$$
$$\sum\limits_{j=0}^k \dfrac{a^m}{m!}=e^a\, \dfrac{\Gamma(k+1,a)}{\Gamma(k+1)},\tag2$$
one can get
$$I_1(a)=\int\limits_0^a x^{-x}\text dx 
= a \int\limits_0^1 (ay)^{-ay} \text dy
= a\int\limits_0^1 e^{-ay\ln a} e^{-ay\ln y}\text dy$$
$$= \sum\limits_{m=0}^\infty \dfrac{\ln^m a}{m!}\sum\limits_{n=0}^\infty (-1)^{m+n} \dfrac {a^{m+n+1}}{n!}\int\limits_0^1  y^{m+n}\ln^n y\,\text dy$$
$$= \sum\limits_{m=0}^\infty \dfrac{\ln^m a}{m!}\sum\limits_{n=0}^\infty (-1)^{m+n} \dfrac {a^{m+n+1}}{n!(m+n+1)^{n+1}}\int\limits_0^1 \ln^n (y^{m+n+1})\,\text dy^{m+n+1}$$
$$= \sum\limits_{m=0}^\infty \dfrac{\ln^m a}{m!}\sum\limits_{n=0}^\infty (-1)^{m+n} \dfrac {a^{m+n+1}}{n!(m+n+1)^{n+1}}\cdot(-1)^n n!$$
$$= \sum\limits_{m=0}^\infty (-1)^m\dfrac{\ln^m a}{m!}\sum\limits_{n=1}^\infty \dfrac {a^{m+n}}{(m+n)^n}
= \sum\limits_{s=1}^\infty \dfrac{a^s}{s^s}\sum\limits_{m=0}^{s-1} 
\dfrac{(-s\ln a)^m}{m!}$$
$$I_1(a)= \sum\limits_{s=1}^\infty \dfrac{\Gamma(s,-s \ln a)}{s^s\Gamma(s)}.\tag3$$
On the other hand,
$$I_2(a)=\int\limits_a^\infty x^{-x}\text dx 
= a \int\limits_0^\infty (a(1+y))^{-a-ay}\text dy
= a^{1-a}\int\limits_0^\infty \dfrac{a^{-ay}}{(1+y)^a} (1+y)^{-ay}\,\text dy.$$
Let $\;z=a^{-ay} = e^{-(a\ln a)y},\;$ then $\;y=-\dfrac{\ln z}{a\ln a},\;$
$$(1+y)^{-ay}=\left(1-\dfrac{\log_a z}a\right)^{\log_a z}
=1 - \dfrac{(z-1)^2}{a\ln^2a}+\dfrac{(z-1)^3(2a\ln a-1)}{2a^2\ln^3a} +\dots 
=\dfrac{(2a^2 \ln^3a-4a\ln a+1) + z(10a\ln a-3) + z^2 (3-8a\ln a) + z^3(2a\ln a-1)}{2a^2\ln^3 a}+\dots,$$
Taking in account the integral
$$\int\limits_0^\infty\dfrac{a^{-kay}}{(1+y)^a} \,\text dy
=a^{ka}\operatorname E_a(ka\ln a),\tag4$$
one can get
$$\begin{align}
&I_2(a)\approx \dfrac1{2a\ln^3 a}\big((2a^2\ln^3a-4a\ln a+1) E_a(a\ln a) + a^a(10a\ln a-3) E_a(2 a\ln a)\\[4pt]
& - a^{2a}(8\ln a-3) E_a(3a\ln a) + a^{3a}(2a\ln a-1) E_a(4a\ln a)\big).
\end{align}\tag5$$
Approximation $(5)$ is not too accurate (accuracy $\;1.5\%\;$ for $\;a=e^2\;$), because only three terms of the primary series was used. However, it shows the effectiveness of the used approach.
If $\;a=e^3,\;$ then $I_1(a)\approx 1.99545\,59575\,00138\,00041\,87246\,96764\,22,$
$I_2(a)\approx 1.69475\cdot10^{-27},$
$\;I_1(a)+I_2(a)\approx
1.99545\,59575\,00138\,00041\,87246\,98458\,97.$
Numeric value is
$I=1.99545\,59575\,00138\,00041\,87246\,98452\,72.$
Easily to see that the second integral increases the result accuracy.
$\color{green}{\mathbf{Edition\ of\ 23.12.21.}}$
The alternative way is
$$I_2(a)=\int\limits_a^\infty x^{-x}\text dx 
= a \int\limits_0^\infty (a(1+y))^{-a-ay}\text dy
= a^{1-a}\int\limits_0^\infty a^{-ay}(1+y)^{-a-ay}\,\text dy.$$
Let $\;z=a^{-ay} = e^{-(a\ln a)y},\;$ then $\;y=-\dfrac{\ln z}{a\ln a},\;$
$$I_2(a)= \dfrac1{a^a\ln a}\int\limits_0^1 \left(1-\dfrac{\log_a z}a\right)^{-a+\log_a z}\text dz 
=\sum\limits_{n=0}^\infty c_n\ln^n z,$$
$$I_2(a) = \sum\limits_{n=0}^\infty (-1)^n n! c_n,\tag6$$
where
$$\sum\limits_{n=0}^\infty c_n y^n = \dfrac 1{a^a\ln a} \left(1-\dfrac y{a \ln a}\right)^{\large-a+\frac y{\ln a}}.\tag7$$
By the direct numeric calculations,
$$I_2(e^3)\approx 1.68850\,13010\,68575\,08677\,67860\,60236\,26323\,88582\cdot10^{-27}.$$
Calculations by $(6)-(7)$ by $20$-term model give
$$I_2(e^3)\approx 1.68850\,13010\,38888\,76584\cdot 10^{-27},$$
i.e. ten additional correct digits of the result.