Is this a solution to the indefinite integral of $e^{-x^2}$? $\int e^{-x^2} \, \mathbb{d} x$, the Gaussian integral, is notorious throughout physics and statistics. Its definite integral defined over $\mathbb{R}$ is $\sqrt{\pi}$. However, the current indefinite integral is not an elementary solution.

Recently I thought about an integration technique that uses "error correcting." If we define a function $f(x)$ such that $f^{(n)}(x)$ still contains terms from $f(x)$ (most likely $f(x)$ will always contain $e^x$), then we can take its derivative, set it up to attempt at the integral, and correct any errors until solution is satisfied. Here's how I went about it:
$$\int e^{-x^2} \, \mathbb{d} x \\
\frac{\mathbb{d}}{\mathbb{d}x} [e^{-x^2}] = -2xe^{-x^2}$$
We can therefore take a naïve guess and state that:
$$\int e^{-x^2} \, \mathbb{d} x = -\frac 1 {2x} e^{-x^2}$$
This isn't true, because differentiated, the result is:
$$e^{-x^2} (1 + \frac 1 {2x^2})$$
Using this, we could try to subtract $\frac{e^{-x^2}}{2x^2}$ from our first approximation of the integral (again, naïve):
$$\int e^{-x^2} \, \mathbb{d} x = e^{-x^2} (-\frac 1 {2x} - \frac 1 {2x^2})$$
Differentiating:
$$e^{-x^2}(1 + x^{-1} + \frac 1 2 x^{-2} + x^{-3})$$
The last three terms seem pretty simple to take the integral of, so if we subtract the integral of those three terms from our guess, perhaps we could obtain the correct answer. Let $\phi$ be our approximation.
$$\phi = e^{-x^2} (-\frac 1 {2x} - \frac 1 {2x^2}) - (\int \frac {e^{-x^2}} x \, \mathbb{d} x + \int \frac{e^{-x^2}} {x^2} \, \mathbb{d} x + \int \frac{e^{-x^2}} {x^3} \, \mathbb{d} x)$$
$$\int \frac {e^{-x^2}} x \, \mathbb{d} x$$
Let us substitute $u = x^2$ and $\mathbb{d}u = 2x \mathbb{d}x$.
$$\frac 1 2 \int \frac {e^{-u}} u \, \mathbb{d} u$$
Substitute $A = e^{-u}$ and $\mathbb{d}A = -e^{-u}$.
$$\frac 1 2 \int \frac {\mathbb{d}A} {\ln A}$$
This is a relatively simple integral.
$$\frac 1 2 \int \frac {\mathbb{d}A} {\ln A} = \frac 1 2 (\ln |\ln A| + \ln A + \sum_{k=2}^{\infty} \frac{\ln^k A}{k k!})$$
We can do the exact same substitution for $\int \frac{e^{-x^2}} {x^3} \, \mathbb{d} x$.
$$\int \frac{e^{-x^2}} {x^3} \, \mathbb{d} x = \frac 1 2 \int \frac {\mathbb{d}A} {\ln^2 A} \\
 = \frac 1 2 (\ln |\ln A| + \ln A + \sum_{k=2}^{\infty} \frac{\ln^k A}{k k!} - \frac A {\ln A})$$
 However, $\int \frac{e^{-x^2}} {x^2} \, \mathbb{d} x$ requires a different substitution. Substitute $u = x^4$, $\mathbb{d}u = 4x^3 \mathbb{d}x$, $G = e^{-u^{1/2}}$, and $\mathbb{d}G = -\frac 1 2 u^{-1/2} e^{-u^{1/2}} \mathbb{d}u$.
 $$\int \frac{e^{-x^2}} {x^2} \, \mathbb{d} x = \frac 1 2 \int \frac{\mathbb{d}G}{\ln^2 G} \\
 = \frac 1 2 (\ln |\ln G| + \ln G + \sum_{k=2}^{\infty} \frac{\ln^k G}{k k!} - \frac G {\ln G})$$
 If we substitute, we find that the integral of $e^{-x^2}$ should be:
$$-e^{-x^2}(\frac 1 {2x} + \frac 1 {2x^2}) +  \frac 3 2 (\ln|x^2| - x^2 + \sum_{k=2}^{\infty}\frac{(-x^2)^k}{k k!}) + \frac {e^{-x^2}}{x^2}$$
However, I believe this evaluates to (when differentiated):
$$e^{-x^2} + \frac 2 x (e^{-x^2} + \frac{e^{-x^2}} x) - \frac {e^{-x^2}} {x^3}$$
I may have made an error in that calculation. Either I am close or I have errored in the final product. Either way, is this a valid method? If so, could someone point out my error? If not, what is the issue?
 A: EDIT: As noted in the comments, formulas (1) and (2) are wrong. I think what happened is that for some reason I worked with $e^{-x^2/2}$ instead of $e^{-x^2}$. I'll put the correct formulas at the end. 
The author finds $$\int e^{-x^2}=A(x)+\sum^{\infty}a_kx^k$$ where $A(x)$ is a simple, elementary function, and the $a_k$ are also simple functions of $k$. I take the opportunity to point out that one can reach such a conclusion a lot faster by noting $$e^{-x^2}=1-(1/2)x^2+(1/2)(1/4)x^4-(1/6)(1/8)x^6+(1/24)(1/16)x^8+\cdots\tag1$$ and integrating term-by-term to get $$\int e^{-x^2}=x-(1/2)(1/3)x^3+(1/2)(1/4)(1/5)x^5-(1/6)(1/8)(1/7)x^7+(1/24)(1/16)(1/9)x^9+\cdots\tag2$$ The general term here is $(-1)^k(1/k!)(1/2^k)(1/(2k+1))x^{2k+1}$. 
As noted earlier, (1) and (2) are actually formulas for $e^{-x^2/2}$ and $\int e^{-x^2/2}\,dx$. The correct formulas are, $$e^{-x^2}=1-x^2+(1/2)x^4-(1/6)x^6+(1/24)x^8+\cdots\tag3$$ and $$\int e^{-x^2}=x-(1/3)x^3+(1/2)(1/5)x^5-(1/6)(1/7)x^7+(1/24)(1/9)x^9+\cdots\tag4$$ The general term here is $(-1)^k(1/k!)(1/(2k+1))x^{2k+1}$. 
