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 ?

Too long for a comment.
The integrand is well defined on $\mathbb{R}\backslash\{0\}$. This is the crucial point then. So how do you work with such cases?
You observe that indeed
$$\int \dfrac{x^2}{\sqrt{x^2+x^4}}\ \text{d}x = \int \dfrac{\vert x\vert }{x} \dfrac{x}{\sqrt{x^2+1}}\ \text{d}x = \int \dfrac{\vert x\vert }{\sqrt{x^2+1}}\ \text{d}x$$
The integrand is well defined in $0$ (indeed for example you can compute the integral from $-1$ to $+1$). Split into positive and negative $x$ and observe.
Consider also the integrand is an even function.
Eventually,
$$\int \dfrac{x^2}{\sqrt{x^2+x^4}}\ \text{d}x = \frac{\sqrt{x^4+x^2}}{x} + C \equiv \dfrac{\vert x\vert \sqrt{x^2+1}}{x} + C = \dfrac{\sqrt{x^2+1}}{\text{sgn(x)}} + C = \sqrt{x^2+1}\ \text{sgn}(x) + C$$
