3.5.52 \(\int \frac {-\sqrt {-1+x}+\sqrt {1+x}}{\sqrt {-1+x}+\sqrt {1+x}} \, dx\) [452]

Optimal. Leaf size=33 \[ \frac {x^2}{2}-\frac {1}{2} \sqrt {-1+x} x \sqrt {1+x}+\frac {1}{2} \cosh ^{-1}(x) \]

[Out]

1/2*x^2+1/2*arccosh(x)-1/2*x*(-1+x)^(1/2)*(1+x)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 4, integrand size = 35, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.114, Rules used = {2129, 6874, 38, 54} \begin {gather*} \frac {x^2}{2}-\frac {1}{2} \sqrt {x-1} \sqrt {x+1} x+\frac {1}{2} \cosh ^{-1}(x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

x^2/2 - (Sqrt[-1 + x]*x*Sqrt[1 + x])/2 + ArcCosh[x]/2

Rule 38

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(m_), x_Symbol] :> Simp[x*(a + b*x)^m*((c + d*x)^m/(2*m + 1))
, x] + Dist[2*a*c*(m/(2*m + 1)), Int[(a + b*x)^(m - 1)*(c + d*x)^(m - 1), x], x] /; FreeQ[{a, b, c, d}, x] &&
EqQ[b*c + a*d, 0] && IGtQ[m + 1/2, 0]

Rule 54

Int[1/(Sqrt[(a_) + (b_.)*(x_)]*Sqrt[(c_) + (d_.)*(x_)]), x_Symbol] :> Simp[ArcCosh[b*(x/a)]/b, x] /; FreeQ[{a,
 b, c, d}, x] && EqQ[a + c, 0] && EqQ[b - d, 0] && GtQ[a, 0]

Rule 2129

Int[(u_)/((e_.)*Sqrt[(a_.) + (b_.)*(x_)] + (f_.)*Sqrt[(c_.) + (d_.)*(x_)]), x_Symbol] :> Dist[-d/(e*(b*c - a*d
)), Int[u*Sqrt[a + b*x], x], x] + Dist[b/(f*(b*c - a*d)), Int[u*Sqrt[c + d*x], x], x] /; FreeQ[{a, b, c, d, e,
 f}, x] && NeQ[b*c - a*d, 0] && EqQ[b*e^2 - d*f^2, 0]

Rule 6874

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.09, size = 42, normalized size = 1.27 \begin {gather*} \frac {1}{2} \left (-1+x^2-\sqrt {-1+x} x \sqrt {1+x}+2 \tanh ^{-1}\left (\frac {1}{\sqrt {\frac {-1+x}{1+x}}}\right )\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(61\) vs. \(2(23)=46\).
time = 0.23, size = 62, normalized size = 1.88

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*(-1+x)^(1/2)*(1+x)^(3/2)+1/2*(-1+x)^(1/2)*(1+x)^(1/2)+1/2*((1+x)*(-1+x))^(1/2)/(1+x)^(1/2)/(-1+x)^(1/2)*l
n(x+(x^2-1)^(1/2))+1/2*x^2

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

integrate((sqrt(x + 1) - sqrt(x - 1))/(sqrt(x + 1) + sqrt(x - 1)), x)

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 37, normalized size = 1.12 \begin {gather*} -\frac {1}{2} \, \sqrt {x + 1} \sqrt {x - 1} x + \frac {1}{2} \, x^{2} - \frac {1}{2} \, \log \left (\sqrt {x + 1} \sqrt {x - 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))/((-1+x)^(1/2)+(1+x)^(1/2)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 16.55, size = 224, normalized size = 6.79 \begin {gather*} - \frac {\left (x - 1\right )^{\frac {5}{2}}}{4 \sqrt {x + 1}} - \frac {3 \left (x - 1\right )^{\frac {3}{2}}}{4 \sqrt {x + 1}} - \frac {\sqrt {x - 1}}{2 \sqrt {x + 1}} + \frac {\left (x - 1\right )^{2}}{4} + 2 \left (\begin {cases} \frac {\left (x + 1\right )^{2}}{8} + \frac {\operatorname {acosh}{\left (\frac {\sqrt {2} \sqrt {x + 1}}{2} \right )}}{4} - \frac {\left (x + 1\right )^{\frac {5}{2}}}{8 \sqrt {x - 1}} + \frac {3 \left (x + 1\right )^{\frac {3}{2}}}{8 \sqrt {x - 1}} - \frac {\sqrt {x + 1}}{4 \sqrt {x - 1}} & \text {for}\: \left |{x + 1}\right | > 2 \\\frac {\left (x + 1\right )^{2}}{8} - \frac {i \operatorname {asin}{\left (\frac {\sqrt {2} \sqrt {x + 1}}{2} \right )}}{4} + \frac {i \left (x + 1\right )^{\frac {5}{2}}}{8 \sqrt {1 - x}} - \frac {3 i \left (x + 1\right )^{\frac {3}{2}}}{8 \sqrt {1 - x}} + \frac {i \sqrt {x + 1}}{4 \sqrt {1 - x}} & \text {otherwise} \end {cases}\right ) + \frac {\operatorname {asinh}{\left (\frac {\sqrt {2} \sqrt {x - 1}}{2} \right )}}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 10.85, size = 200, normalized size = 6.06 \begin {gather*} \mathrm {acosh}\left (x\right )-2\,\mathrm {atanh}\left (\frac {\sqrt {x-1}-\mathrm {i}}{\sqrt {x+1}-1}\right )+\frac {\frac {14\,{\left (\sqrt {x-1}-\mathrm {i}\right )}^3}{{\left (\sqrt {x+1}-1\right )}^3}+\frac {14\,{\left (\sqrt {x-1}-\mathrm {i}\right )}^5}{{\left (\sqrt {x+1}-1\right )}^5}+\frac {2\,{\left (\sqrt {x-1}-\mathrm {i}\right )}^7}{{\left (\sqrt {x+1}-1\right )}^7}+\frac {2\,\left (\sqrt {x-1}-\mathrm {i}\right )}{\sqrt {x+1}-1}}{1+\frac {6\,{\left (\sqrt {x-1}-\mathrm {i}\right )}^4}{{\left (\sqrt {x+1}-1\right )}^4}-\frac {4\,{\left (\sqrt {x-1}-\mathrm {i}\right )}^6}{{\left (\sqrt {x+1}-1\right )}^6}+\frac {{\left (\sqrt {x-1}-\mathrm {i}\right )}^8}{{\left (\sqrt {x+1}-1\right )}^8}-\frac {4\,{\left (\sqrt {x-1}-\mathrm {i}\right )}^2}{{\left (\sqrt {x+1}-1\right )}^2}}+\frac {x^2}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

acosh(x) - 2*atanh(((x - 1)^(1/2) - 1i)/((x + 1)^(1/2) - 1)) + ((14*((x - 1)^(1/2) - 1i)^3)/((x + 1)^(1/2) - 1
)^3 + (14*((x - 1)^(1/2) - 1i)^5)/((x + 1)^(1/2) - 1)^5 + (2*((x - 1)^(1/2) - 1i)^7)/((x + 1)^(1/2) - 1)^7 + (
2*((x - 1)^(1/2) - 1i))/((x + 1)^(1/2) - 1))/((6*((x - 1)^(1/2) - 1i)^4)/((x + 1)^(1/2) - 1)^4 - (4*((x - 1)^(
1/2) - 1i)^2)/((x + 1)^(1/2) - 1)^2 - (4*((x - 1)^(1/2) - 1i)^6)/((x + 1)^(1/2) - 1)^6 + ((x - 1)^(1/2) - 1i)^
8/((x + 1)^(1/2) - 1)^8 + 1) + x^2/2

________________________________________________________________________________________