### 3.325 $$\int \sqrt{1+x-x^2} \, dx$$

Optimal. Leaf size=38 $-\frac{1}{4} \sqrt{-x^2+x+1} (1-2 x)-\frac{5}{8} \sin ^{-1}\left (\frac{1-2 x}{\sqrt{5}}\right )$

[Out]

-((1 - 2*x)*Sqrt[1 + x - x^2])/4 - (5*ArcSin[(1 - 2*x)/Sqrt[5]])/8

________________________________________________________________________________________

Rubi [A]  time = 0.0117996, antiderivative size = 38, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 12, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.25, Rules used = {612, 619, 216} $-\frac{1}{4} \sqrt{-x^2+x+1} (1-2 x)-\frac{5}{8} \sin ^{-1}\left (\frac{1-2 x}{\sqrt{5}}\right )$

Antiderivative was successfully veriﬁed.

[In]

Int[Sqrt[1 + x - x^2],x]

[Out]

-((1 - 2*x)*Sqrt[1 + x - x^2])/4 - (5*ArcSin[(1 - 2*x)/Sqrt[5]])/8

Rule 612

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((b + 2*c*x)*(a + b*x + c*x^2)^p)/(2*c*(2*p +
1)), x] - Dist[(p*(b^2 - 4*a*c))/(2*c*(2*p + 1)), Int[(a + b*x + c*x^2)^(p - 1), x], x] /; FreeQ[{a, b, c}, x]
&& NeQ[b^2 - 4*a*c, 0] && GtQ[p, 0] && IntegerQ[4*p]

Rule 619

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dist[1/(2*c*((-4*c)/(b^2 - 4*a*c))^p), Subst[Int[Si
mp[1 - x^2/(b^2 - 4*a*c), x]^p, x], x, b + 2*c*x], x] /; FreeQ[{a, b, c, p}, x] && GtQ[4*a - b^2/c, 0]

Rule 216

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSin[(Rt[-b, 2]*x)/Sqrt[a]]/Rt[-b, 2], x] /; FreeQ[{a, b}
, x] && GtQ[a, 0] && NegQ[b]

Rubi steps

\begin{align*} \int \sqrt{1+x-x^2} \, dx &=-\frac{1}{4} (1-2 x) \sqrt{1+x-x^2}+\frac{5}{8} \int \frac{1}{\sqrt{1+x-x^2}} \, dx\\ &=-\frac{1}{4} (1-2 x) \sqrt{1+x-x^2}-\frac{1}{8} \sqrt{5} \operatorname{Subst}\left (\int \frac{1}{\sqrt{1-\frac{x^2}{5}}} \, dx,x,1-2 x\right )\\ &=-\frac{1}{4} (1-2 x) \sqrt{1+x-x^2}-\frac{5}{8} \sin ^{-1}\left (\frac{1-2 x}{\sqrt{5}}\right )\\ \end{align*}

Mathematica [A]  time = 0.0146953, size = 39, normalized size = 1.03 $\left (\frac{x}{2}-\frac{1}{4}\right ) \sqrt{-x^2+x+1}-\frac{5}{8} \sin ^{-1}\left (\frac{1-2 x}{\sqrt{5}}\right )$

Antiderivative was successfully veriﬁed.

[In]

Integrate[Sqrt[1 + x - x^2],x]

[Out]

(-1/4 + x/2)*Sqrt[1 + x - x^2] - (5*ArcSin[(1 - 2*x)/Sqrt[5]])/8

________________________________________________________________________________________

Maple [A]  time = 0.003, size = 30, normalized size = 0.8 \begin{align*} -{\frac{1-2\,x}{4}\sqrt{-{x}^{2}+x+1}}+{\frac{5}{8}\arcsin \left ({\frac{2\,\sqrt{5}}{5} \left ( x-{\frac{1}{2}} \right ) } \right ) } \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int((-x^2+x+1)^(1/2),x)

[Out]

-1/4*(1-2*x)*(-x^2+x+1)^(1/2)+5/8*arcsin(2/5*5^(1/2)*(x-1/2))

________________________________________________________________________________________

Maxima [A]  time = 1.41514, size = 53, normalized size = 1.39 \begin{align*} \frac{1}{2} \, \sqrt{-x^{2} + x + 1} x - \frac{1}{4} \, \sqrt{-x^{2} + x + 1} - \frac{5}{8} \, \arcsin \left (-\frac{1}{5} \, \sqrt{5}{\left (2 \, x - 1\right )}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((-x^2+x+1)^(1/2),x, algorithm="maxima")

[Out]

1/2*sqrt(-x^2 + x + 1)*x - 1/4*sqrt(-x^2 + x + 1) - 5/8*arcsin(-1/5*sqrt(5)*(2*x - 1))

________________________________________________________________________________________

Fricas [A]  time = 2.12894, size = 101, normalized size = 2.66 \begin{align*} \frac{1}{4} \, \sqrt{-x^{2} + x + 1}{\left (2 \, x - 1\right )} - \frac{5}{4} \, \arctan \left (\frac{\sqrt{-x^{2} + x + 1} - 1}{x}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((-x^2+x+1)^(1/2),x, algorithm="fricas")

[Out]

1/4*sqrt(-x^2 + x + 1)*(2*x - 1) - 5/4*arctan((sqrt(-x^2 + x + 1) - 1)/x)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \sqrt{- x^{2} + x + 1}\, dx \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((-x**2+x+1)**(1/2),x)

[Out]

Integral(sqrt(-x**2 + x + 1), x)

________________________________________________________________________________________

Giac [A]  time = 1.05773, size = 42, normalized size = 1.11 \begin{align*} \frac{1}{4} \, \sqrt{-x^{2} + x + 1}{\left (2 \, x - 1\right )} + \frac{5}{8} \, \arcsin \left (\frac{1}{5} \, \sqrt{5}{\left (2 \, x - 1\right )}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((-x^2+x+1)^(1/2),x, algorithm="giac")

[Out]

1/4*sqrt(-x^2 + x + 1)*(2*x - 1) + 5/8*arcsin(1/5*sqrt(5)*(2*x - 1))