Indefinite integral $\int \frac{x^2}{\sqrt{x^2 + x^4}} \, dx $ involving $\mathrm{sgn}()$ function How to solve integrals like 
$$\int \frac{x^2}{\sqrt{x^2 + x^4}} \, dx $$
If we factor out $x^2$ from denominator it become 
$=\int \frac{x}{\left| x \right|} \frac{x}{\sqrt{1 + x^2}} \, dx $ 
$=\int \mathrm{sgn}(x) \frac{x}{\sqrt{1 + x^2}} \, dx $ 
What to do next ?
can't we do this like 
$=\int \frac{x}{x} \frac{x}{\sqrt{1 + x^2}} \, dx $ 
$=\int  \frac{x}{\sqrt{1 + x^2}} \, dx $  it becomes an easy integral with substitution now.  
Is it wrong ?
So my quetion  is that can we write $\sqrt{x^2}$  as x in this case ?

To avoid the sign function, integrate as follows
\begin{align}
\int \frac{x^2}{\sqrt{x^2 + x^4}}dx 
=\int \frac{\sqrt{x^2 + x^4}}{x^2}\overset{ibp}{dx}
- \int \frac{1}{\sqrt{x^2 + x^4}} dx
=\frac{\sqrt{x^2 + x^4}}{x}
\end{align}
