\(\int \frac {\sqrt {-2+x}}{2+x} \, dx\) [266]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 24 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2 \sqrt {-2+x}-4 \arctan \left (\frac {\sqrt {-2+x}}{2}\right ) \]

[Out]

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

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {52, 65, 209} \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2 \sqrt {x-2}-4 \arctan \left (\frac {\sqrt {x-2}}{2}\right ) \]

[In]

Int[Sqrt[-2 + x]/(2 + x),x]

[Out]

2*Sqrt[-2 + x] - 4*ArcTan[Sqrt[-2 + x]/2]

Rule 52

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^n/(b*(
m + n + 1))), x] + Dist[n*((b*c - a*d)/(b*(m + n + 1))), Int[(a + b*x)^m*(c + d*x)^(n - 1), x], x] /; FreeQ[{a
, b, c, d}, x] && NeQ[b*c - a*d, 0] && GtQ[n, 0] && NeQ[m + n + 1, 0] &&  !(IGtQ[m, 0] && ( !IntegerQ[n] || (G
tQ[m, 0] && LtQ[m - n, 0]))) &&  !ILtQ[m + n + 2, 0] && IntLinearQ[a, b, c, d, m, n, x]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 209

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

Rubi steps \begin{align*} \text {integral}& = 2 \sqrt {-2+x}-4 \int \frac {1}{\sqrt {-2+x} (2+x)} \, dx \\ & = 2 \sqrt {-2+x}-8 \text {Subst}\left (\int \frac {1}{4+x^2} \, dx,x,\sqrt {-2+x}\right ) \\ & = 2 \sqrt {-2+x}-4 \arctan \left (\frac {\sqrt {-2+x}}{2}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2 \sqrt {-2+x}-4 \arctan \left (\frac {\sqrt {-2+x}}{2}\right ) \]

[In]

Integrate[Sqrt[-2 + x]/(2 + x),x]

[Out]

2*Sqrt[-2 + x] - 4*ArcTan[Sqrt[-2 + x]/2]

Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.79

method result size
derivativedivides \(-4 \arctan \left (\frac {\sqrt {-2+x}}{2}\right )+2 \sqrt {-2+x}\) \(19\)
default \(-4 \arctan \left (\frac {\sqrt {-2+x}}{2}\right )+2 \sqrt {-2+x}\) \(19\)
risch \(-4 \arctan \left (\frac {\sqrt {-2+x}}{2}\right )+2 \sqrt {-2+x}\) \(19\)
trager \(2 \sqrt {-2+x}+2 \operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right ) \ln \left (\frac {\operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right ) x -6 \operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right )+4 \sqrt {-2+x}}{2+x}\right )\) \(48\)

[In]

int((-2+x)^(1/2)/(2+x),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.75 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2 \, \sqrt {x - 2} - 4 \, \arctan \left (\frac {1}{2} \, \sqrt {x - 2}\right ) \]

[In]

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

[Out]

2*sqrt(x - 2) - 4*arctan(1/2*sqrt(x - 2))

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.77 (sec) , antiderivative size = 109, normalized size of antiderivative = 4.54 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=\begin {cases} - 4 i \operatorname {acosh}{\left (\frac {2}{\sqrt {x + 2}} \right )} - \frac {2 i \sqrt {x + 2}}{\sqrt {-1 + \frac {4}{x + 2}}} + \frac {8 i}{\sqrt {-1 + \frac {4}{x + 2}} \sqrt {x + 2}} & \text {for}\: \frac {1}{\left |{x + 2}\right |} > \frac {1}{4} \\4 \operatorname {asin}{\left (\frac {2}{\sqrt {x + 2}} \right )} + \frac {2 \sqrt {x + 2}}{\sqrt {1 - \frac {4}{x + 2}}} - \frac {8}{\sqrt {1 - \frac {4}{x + 2}} \sqrt {x + 2}} & \text {otherwise} \end {cases} \]

[In]

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

[Out]

Piecewise((-4*I*acosh(2/sqrt(x + 2)) - 2*I*sqrt(x + 2)/sqrt(-1 + 4/(x + 2)) + 8*I/(sqrt(-1 + 4/(x + 2))*sqrt(x
 + 2)), 1/Abs(x + 2) > 1/4), (4*asin(2/sqrt(x + 2)) + 2*sqrt(x + 2)/sqrt(1 - 4/(x + 2)) - 8/(sqrt(1 - 4/(x + 2
))*sqrt(x + 2)), True))

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.75 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2 \, \sqrt {x - 2} - 4 \, \arctan \left (\frac {1}{2} \, \sqrt {x - 2}\right ) \]

[In]

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

[Out]

2*sqrt(x - 2) - 4*arctan(1/2*sqrt(x - 2))

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.75 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2 \, \sqrt {x - 2} - 4 \, \arctan \left (\frac {1}{2} \, \sqrt {x - 2}\right ) \]

[In]

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

[Out]

2*sqrt(x - 2) - 4*arctan(1/2*sqrt(x - 2))

Mupad [B] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.75 \[ \int \frac {\sqrt {-2+x}}{2+x} \, dx=2\,\sqrt {x-2}-4\,\mathrm {atan}\left (\frac {\sqrt {x-2}}{2}\right ) \]

[In]

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

[Out]

2*(x - 2)^(1/2) - 4*atan((x - 2)^(1/2)/2)