Expressions for integrals of non-elementary integrals Functions like $\frac1{\log x}$ have no elementary integrals in terms of standard functions; they are instead represented using special function notations, such as $\mathrm{li}(x)$.
That's all and well, but how does one obtain an expression for the integral of these nonelementary integrals?
I would expect that there would be "no result found in terms of standard mathematical functions", but WolframAlpha actually gives an expression for the logarithmic integral:
$$\int \mathrm{li}(x)dx = x \, \mathrm{li}(x) - \mathrm{Ei}(2 \log x) + C.$$
(Or $x \, \mathrm{li}(x) - \mathrm{li}(x^2) + C$, for an appropriate choice of domain.)
How does WolframAlpha obtain such a result? Is there a special technique that I am unaware of?
 A: In general, there is still often no elementary solution to these kinds of integrals.
In this case, however, there is fortunately a relatively simple way to evaluate the integral of $\mathrm{li}(x)$, involving integration by parts to first break down the nonelementary integral inside and to hope for a way to rearrange it into a simpler form.
So, using integration by parts, we find
$$\int \mathrm{li}(x) \, dx = x \, \mathrm{li}(x) - \int \frac{x}{\log x} \, dx.$$
We can evaluate this new integral using the substitution $u = \log x$, which leads to $x = e^u$ and $dx = e^u \, du$.
\begin{align}
\int \frac{x}{\log x} \, dx & = \int \frac{e^u}u e^u \, du \\
& = \int \frac{e^{2u}}u \, du.
\end{align}
This is itself a nonelementary integral, but a common special function exists that can describe it: the exponential integral, $$\mathrm{Ei}(x) \equiv - \int_{-z}^\infty \frac{e^{-t}}t \, dt.$$
In this case, though, we're only worrying about the indefinite integral, so we'll just use
$$\mathrm{Ei}(x) \equiv \int \frac{e^x}x \, dx.$$
So, using this, our integral becomes with $v = 2u$
\begin{align}
\int \frac{e^{2u}}u \, du & = \int \frac{e^v}{\frac{v}2} \, \frac{dv}2 \\
& = \int \frac{e^v}v \, dv \\
& = \mathrm{Ei}(v) \\
& = \mathrm{Ei}(2 \log x).
\end{align}
Substituting this back into our original integral, we obtain
$$\int \mathrm{li}(x) \, dx = x \, \mathrm{li}(x) - \mathrm{Ei}(2 \log x) + C.$$
A: Not being a pure mathematician it is not at first obvious to me that integration by parts should automatically work for a function like $\text{li}(x)=\int_0^x \frac{1}{\log t} \,dt$ for which there is no infinite series expansion.
It's seems slightly clearer to me in this case to take the proposed solution and approach this problem by differentiating $x \,\text{li}(x)$ and $\text{li}(x^2)$ instead (even though I am differentiating a definite integral which is not the normal case):
$$\frac{d \,(x \,\text{li}(x))}{d x}=\text{li}(x)+\frac{x}{\log (x)}$$
Then rearranging and integrating gives
$$\int \text{li}(x) \, dx=x \,\text{li}(x)-\int \frac{x}{\log (x)} dx$$
and then since
$$\frac{d\, (\text{li}(x^2))}{d x}=\frac{2x}{\log (x^2)}=\frac{x}{\log (x)}$$
$$\int \frac{x}{\log (x)}\, dx= \text{li}(x^2)$$ 
Giving
$$\int \text{li}(x) \, dx=x \,\text{li}(x)-\text{li}(x^2)$$
Then finally finding $\text{li}(x^2)$ in terms of the exponential integral as in @Bladewood's answer.   
[I am not happy with this - is it more rigorous to prove that this only works when the lower limit in the $\text{li}(x)$ function integral is constant?]
