I'm trying to evaluate the following indefinite integral:
$$ \int\frac{e^{-x^2}}{(1+2x^2)^2}dx $$
According to Wolfram|Alpha, this integral evaluates to:
$$ \int \frac{e^{-x^2}}{(1+2 x^2)^2} dx = \frac{1}{4}\left(\sqrt{\pi} \mathrm{erf}(x)+\frac{2x e^{-x^2}}{(2 x^2+1)}\right)+\mathrm{constant} $$
Is there a quick way of evaluating this integral to get that answer? A fairly obvious-looking integration-by-parts approach didn't work but looked fairly promising:
\begin{align} \int \frac{e^{-x^2}}{(1+2 x^2)^2} dx &= \frac{1}{4}\int \frac{e^{-x^2}}{x}\times\frac{4x}{(1+2 x^2)^2}dx \\ &=\frac{1}{4}\left(\frac{-e^{-x^2}}{x(1+2x^2)}+\int\frac{1}{(1+2x^2)}\times\frac{-2x^2e^{-x^2}-e^{-x^2}}{x^2}dx\right) \\ &=\frac{1}{4}\left(-\frac{e^{-x^2}}{x(1+2x^2)}-\int\frac{e^{-x^2}}{x^2}dx\right) \end{align}
If both the boundary term and the integrand were multiplied by $-2x^2$, this would be exactly what we want, since the integral on the right would then evaluate to $\sqrt{\pi}\mathrm{erf}(x)$. Is there some other integration by parts that I've missed? Or is it only possible to do the integral by more complicated means?
Try doing integration by parts on this term as well with $u = \exp(-x^2)$ and $dv = \frac{1}{x^2}dx$. Combine some terms and I think you'll have your result.