Recently, I was working with power towers. I was interested in $x^x$; it is easy to know its derivative, but I wanted to find its integral. Here's what I found. Please let me know if it is right or wrong.
We have $$x^x = e^{x\ln(x)}$$
Now, $e^{x \ln x}$ is same as writing $ e^{\left(\sqrt{x\ln x}\right)^2}$.
We know that,
\begin{align}\int e^{x^2} \,dx &= \frac {\sqrt\pi}{2} \operatorname{erfi}(x) +c\\[5pt]
\implies \int e^{\sqrt {(x \ln x)}^2}\, dx &= \frac {\frac {\sqrt\pi}{2}\operatorname{erfi}\left(\sqrt{x\ln x}\right)}{\frac {d\left(\sqrt{x \ln x}\right)}{dx}} +c
\end{align}
Comparing, we get,$$\int {x^x}\, dx = \frac {\frac {\sqrt\pi}{2}\operatorname{erfi}\left(\sqrt{x\ln x}\right)}{\frac {d\left(\sqrt{x \ln x}\right)}{dx}}+c $$
Simplifying, we get$$\int {x^x}\, dx = \frac {\sqrt{\pi x \ln x} \cdot \operatorname{erfi}\left(\sqrt{x \ln x}\right)}{1+\ln x} + c$$
Please help me know if it is correct/incorrect. Also, if correct, please tell me how to evaluate it by taking upper & lower limits.
Thanks !


The issue here is that $$\int e^{\left(\sqrt{x\ln x}\right)^2}\, dx = \frac {\frac {\sqrt\pi}{2}\operatorname{erfi}\left(\sqrt{x\ln x}\right)}{\frac {d\left(\sqrt{x \ln x}\right)}{dx}} +c$$ is not true. If we differentiate the right-hand side, we should obtain $e^{\left(\sqrt{x\ln x}\right)^2}$, but we don't. Instead, we get $$\frac{\sqrt{\pi} \operatorname{erfi}\left(\sqrt{x\ln x}\right)}{2\sqrt{x\ln x}} - \frac{\sqrt{\pi x\ln x}\operatorname{erfi}\left(\sqrt{x\ln x}\right)}{x\left(\ln x + 1\right)^2} + x^x, $$ see WolframAlpha. The issue is that there is no substitution that gives the change of variables $$\int e^{\left(\sqrt{x\ln x}\right)^2}\, dx \longrightarrow \int e^{x^{2}}\,dx.$$ We would need try to use the substitution \begin{align} u &= \sqrt{x\ln x}\\ du &= \frac{\ln x + 1}{2\sqrt{x\ln x}}\,dx \end{align} which will not give us the intended transformation.