3.5.23 \(\int \frac {(\sqrt {1-x}+\sqrt {1+x})^2}{x} \, dx\) [423]

Optimal. Leaf size=32 \[ 2 \sqrt {1-x^2}-2 \tanh ^{-1}\left (\sqrt {1-x^2}\right )+2 \log (x) \]

[Out]

-2*arctanh((-x^2+1)^(1/2))+2*ln(x)+2*(-x^2+1)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {6874, 272, 52, 65, 212} \begin {gather*} 2 \sqrt {1-x^2}-2 \tanh ^{-1}\left (\sqrt {1-x^2}\right )+2 \log (x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

2*Sqrt[1 - x^2] - 2*ArcTanh[Sqrt[1 - x^2]] + 2*Log[x]

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 212

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

Rule 272

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a
+ b*x)^p, x], x, x^n], x] /; FreeQ[{a, b, m, n, p}, x] && IntegerQ[Simplify[(m + 1)/n]]

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {align*} \int \frac {\left (\sqrt {1-x}+\sqrt {1+x}\right )^2}{x} \, dx &=\int \left (\frac {2}{x}+\frac {2 \sqrt {1-x^2}}{x}\right ) \, dx\\ &=2 \log (x)+2 \int \frac {\sqrt {1-x^2}}{x} \, dx\\ &=2 \log (x)+\text {Subst}\left (\int \frac {\sqrt {1-x}}{x} \, dx,x,x^2\right )\\ &=2 \sqrt {1-x^2}+2 \log (x)+\text {Subst}\left (\int \frac {1}{\sqrt {1-x} x} \, dx,x,x^2\right )\\ &=2 \sqrt {1-x^2}+2 \log (x)-2 \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sqrt {1-x^2}\right )\\ &=2 \sqrt {1-x^2}-2 \tanh ^{-1}\left (\sqrt {1-x^2}\right )+2 \log (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(81\) vs. \(2(32)=64\).
time = 0.18, size = 81, normalized size = 2.53 \begin {gather*} \frac {4 \left (-1+\sqrt {1-x}\right )^2 \left (-1+\sqrt {1+x}\right )^2}{\left (-2+\sqrt {1-x}+\sqrt {1+x}\right )^2}-8 \tanh ^{-1}\left (\frac {-2-x+2 \sqrt {1+x}}{-2+2 \sqrt {1-x}+x}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 51, normalized size = 1.59

method result size
default \(2 \ln \left (x \right )+\frac {2 \sqrt {1-x}\, \sqrt {1+x}\, \left (\sqrt {-x^{2}+1}-\arctanh \left (\frac {1}{\sqrt {-x^{2}+1}}\right )\right )}{\sqrt {-x^{2}+1}}\) \(51\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*ln(x)+2*(1-x)^(1/2)*(1+x)^(1/2)/(-x^2+1)^(1/2)*((-x^2+1)^(1/2)-arctanh(1/(-x^2+1)^(1/2)))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 41, normalized size = 1.28 \begin {gather*} 2 \, \sqrt {-x^{2} + 1} + 2 \, \log \left (x\right ) - 2 \, \log \left (\frac {2 \, \sqrt {-x^{2} + 1}}{{\left | x \right |}} + \frac {2}{{\left | x \right |}}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*sqrt(-x^2 + 1) + 2*log(x) - 2*log(2*sqrt(-x^2 + 1)/abs(x) + 2/abs(x))

________________________________________________________________________________________

Fricas [A]
time = 0.32, size = 41, normalized size = 1.28 \begin {gather*} 2 \, \sqrt {x + 1} \sqrt {-x + 1} + 2 \, \log \left (x\right ) + 2 \, \log \left (\frac {\sqrt {x + 1} \sqrt {-x + 1} - 1}{x}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*sqrt(x + 1)*sqrt(-x + 1) + 2*log(x) + 2*log((sqrt(x + 1)*sqrt(-x + 1) - 1)/x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (\sqrt {1 - x} + \sqrt {x + 1}\right )^{2}}{x}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: NotImplementedError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: NotImplementedError >> Unable to parse Giac output: Warning, choosing root of [1,0,-4,0,%%%{
4,[2]%%%}] at parameters values [5.38357630698]Warning, choosing root of [1,0,-4,0,%%%{4,[2]%%%}] at parameter
s values [81.11954429

________________________________________________________________________________________

Mupad [B]
time = 4.10, size = 122, normalized size = 3.81 \begin {gather*} 2\,\ln \left (\frac {{\left (\sqrt {1-x}-1\right )}^2}{{\left (\sqrt {x+1}-1\right )}^2}-1\right )-2\,\ln \left (\frac {\sqrt {1-x}-1}{\sqrt {x+1}-1}\right )+2\,\ln \left (x\right )+\frac {16\,{\left (\sqrt {1-x}-1\right )}^2}{{\left (\sqrt {x+1}-1\right )}^2\,\left (\frac {2\,{\left (\sqrt {1-x}-1\right )}^2}{{\left (\sqrt {x+1}-1\right )}^2}+\frac {{\left (\sqrt {1-x}-1\right )}^4}{{\left (\sqrt {x+1}-1\right )}^4}+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*log(((1 - x)^(1/2) - 1)^2/((x + 1)^(1/2) - 1)^2 - 1) - 2*log(((1 - x)^(1/2) - 1)/((x + 1)^(1/2) - 1)) + 2*lo
g(x) + (16*((1 - x)^(1/2) - 1)^2)/(((x + 1)^(1/2) - 1)^2*((2*((1 - x)^(1/2) - 1)^2)/((x + 1)^(1/2) - 1)^2 + ((
1 - x)^(1/2) - 1)^4/((x + 1)^(1/2) - 1)^4 + 1))

________________________________________________________________________________________