<s>[INST] How to evaluate this integral with square trinomial and root? I have to evaluate this integral:
$$\int{\frac{1-x+x^2}{x\sqrt{1+x-x^2}}dx}$$
I have experience with methods such as:

*

*Using substitute for x;
for example, $${\frac{1}{x}=t;dx = -\frac{dt}{t^2}}$$


*Method of adding a new variable;


*Substitution method;


*Integration by the parts.
In addition, I just need to mention, that we have learned topic with square trinomial.
Just remake this expression:
$${1+x-x^2}={\frac{5}{4}-(x-\frac{1}{2})^2}$$
And, of course, then we can use some formulas for evaluation, when have expression in required view. Thanks!
 [/INST] $\int{\frac{1-x+x^2}{x\sqrt{1+x-x^2}}dx}$
The rooted is a trinomial ($a x^{2}+2b x+c$), which has two real roots $\alpha$ and $\beta$, decomposing it we have:
$\sqrt{a x^{2}+2b x+c}=\sqrt{a(x-\alpha)(x-\beta)}=(x-\beta)\sqrt{\frac{a(x-\alpha)}{x-\beta}}$.
Let's say
$\frac{a(x-\alpha)}{x-\beta}=t^{2}$, and we get :
$x=\frac{a\alpha-\beta t^{2}}{a-t^{2}}$
$dx=\frac{2 a t(\alpha-\beta)}{(a-t^{2})^{2}}dt$.
Substituting these values in the integral, we have:
$\int{\frac{1-x+x^2}{x\sqrt{1+x-x^2}}dx}=$,
$=-\int{\frac{4(2t^{4}-t^{2}+2)}{(t^{2}+1)^{2}(t^{2}(\sqrt{5}+1)-\sqrt{5}+1)}dt}=$,
expanding
$=\int{\frac{2\sqrt{5}}{(t^{2}+1)^{2}}dt}$
+$\int{\frac{1-\sqrt{5}}{t^{2}+1}dt}$
-$\int{\frac{4}{ t^{2}(\sqrt{5}+1)-\sqrt{5}+1)}dt}$.
Calculating the individual integrals:
$I_{1}=\sqrt{5} .tan^{-1}(t)+\frac{\sqrt{5}t}{t^{2}+1}$,
$I_{2}=(1-\sqrt{5}).   tan^{-1}(t)$,
$I_{3}=-ln(\frac{2t-\sqrt{5}+1}{2t+\sqrt{5}-1})$.
Ultimately you have:
$I=I_{1}+I_{2}+I_{3}=tan^{-1}(t)+\frac{\sqrt{5}t}{t^{2}+1}-ln(\frac{2t-\sqrt{5}+1}{2t+\sqrt{5}-1})$.
All that remains is to replace the value of $t$ with $x$:
$t=\frac{-2x-\sqrt{5}+1}{2x-\sqrt{5}-1}$,
getting the result.
</s>