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

Optimal. Leaf size=24 \[ 2 \sqrt {-2+x}-4 \tan ^{-1}\left (\frac {\sqrt {-2+x}}{2}\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.00, antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {52, 65, 209} \begin {gather*} 2 \sqrt {x-2}-4 \tan ^{-1}\left (\frac {\sqrt {x-2}}{2}\right ) \end {gather*}

Antiderivative was successfully verified.

[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*} \int \frac {\sqrt {-2+x}}{2+x} \, dx &=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 \tan ^{-1}\left (\frac {\sqrt {-2+x}}{2}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 24, normalized size = 1.00 \begin {gather*} 2 \sqrt {-2+x}-4 \tan ^{-1}\left (\frac {\sqrt {-2+x}}{2}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Mathics [C] Result contains higher order function than in optimal. Order 9 vs. order 3 in optimal.
time = 2.82, size = 111, normalized size = 4.62 \begin {gather*} \text {Piecewise}\left [\left \{\left \{\frac {2 I \left (x \sqrt {\frac {2-x}{2+x}}-2 \text {ArcCosh}\left [\frac {2}{\sqrt {2+x}}\right ] \sqrt {2+x}+2 \sqrt {\frac {2-x}{2+x}}\right )}{\sqrt {2+x}},\frac {1}{\text {Abs}\left [2+x\right ]}>\frac {1}{4}\right \}\right \},\frac {-8}{\sqrt {1-\frac {4}{2+x}} \sqrt {2+x}}+\frac {2 \sqrt {2+x}}{\sqrt {1-\frac {4}{2+x}}}+4 \text {ArcSin}\left [\frac {2}{\sqrt {2+x}}\right ]\right ] \end {gather*}

Warning: Unable to verify antiderivative.

[In]

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

[Out]

Piecewise[{{2 I (x Sqrt[(2 - x) / (2 + x)] - 2 ArcCosh[2 / Sqrt[2 + x]] Sqrt[2 + x] + 2 Sqrt[(2 - x) / (2 + x)
]) / Sqrt[2 + x], 1 / Abs[2 + x] > 1 / 4}}, -8 / (Sqrt[1 - 4 / (2 + x)] Sqrt[2 + x]) + 2 Sqrt[2 + x] / Sqrt[1
- 4 / (2 + x)] + 4 ArcSin[2 / Sqrt[2 + x]]]

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 19, normalized size = 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 \RootOf \left (\textit {\_Z}^{2}+1\right ) \ln \left (\frac {\RootOf \left (\textit {\_Z}^{2}+1\right ) x +4 \sqrt {-2+x}-6 \RootOf \left (\textit {\_Z}^{2}+1\right )}{2+x}\right )\) \(48\)

Verification of antiderivative is not currently implemented for this CAS.

[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)

________________________________________________________________________________________

Maxima [A]
time = 0.38, size = 18, normalized size = 0.75 \begin {gather*} 2 \, \sqrt {x - 2} - 4 \, \arctan \left (\frac {1}{2} \, \sqrt {x - 2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.32, size = 18, normalized size = 0.75 \begin {gather*} 2 \, \sqrt {x - 2} - 4 \, \arctan \left (\frac {1}{2} \, \sqrt {x - 2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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] Result contains complex when optimal does not.
time = 0.60, size = 109, normalized size = 4.54 \begin {gather*} \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} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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))

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 24, normalized size = 1.00 \begin {gather*} 2 \sqrt {x-2}-4 \arctan \left (\frac {\sqrt {x-2}}{2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.04, size = 18, normalized size = 0.75 \begin {gather*} 2\,\sqrt {x-2}-4\,\mathrm {atan}\left (\frac {\sqrt {x-2}}{2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________