3.6.20 \(\int \frac {(-1+x^2) \sqrt {1+2 x^2+x^4}}{(1+x^2) (1+x^4)} \, dx\) [520]

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

[Out]

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

________________________________________________________________________________________

Rubi [C] Result contains complex when optimal does not.
time = 0.38, antiderivative size = 74, normalized size of antiderivative = 1.85, number of steps used = 12, number of rules used = 7, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.206, Rules used = {6857, 1161, 8, 1162, 396, 212, 209} \begin {gather*} \frac {\sqrt {x^4+2 x^2+1} \tanh ^{-1}\left ((-1)^{3/4} x\right )}{\sqrt {2} \left (x^2+1\right )}+\frac {i \sqrt {x^4+2 x^2+1} \text {ArcTan}\left ((-1)^{3/4} x\right )}{\sqrt {2} \left (x^2+1\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

(I*Sqrt[1 + 2*x^2 + x^4]*ArcTan[(-1)^(3/4)*x])/(Sqrt[2]*(1 + x^2)) + (Sqrt[1 + 2*x^2 + x^4]*ArcTanh[(-1)^(3/4)
*x])/(Sqrt[2]*(1 + x^2))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, 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])

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 396

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

Rule 1161

Int[((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Dist[(a + b*x^2 + c*x^
4)^p/(d + e*x^2)^(2*p), Int[(d + e*x^2)^(q + 2*p), x], x] /; FreeQ[{a, b, c, d, e, p, q}, x] && EqQ[b^2 - 4*a*
c, 0] &&  !IntegerQ[p] && EqQ[2*c*d - b*e, 0]

Rule 1162

Int[((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Dist[(a + b*x^2 + c*x^
4)^FracPart[p]/(c^IntPart[p]*(b/2 + c*x^2)^(2*FracPart[p])), Int[(d + e*x^2)^q*(b/2 + c*x^2)^(2*p), x], x] /;
FreeQ[{a, b, c, d, e, p, q}, x] && EqQ[b^2 - 4*a*c, 0] &&  !IntegerQ[p]

Rule 6857

Int[(u_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> With[{v = RationalFunctionExpand[u/(a + b*x^n), x]}, Int[v, x]
 /; SumQ[v]] /; FreeQ[{a, b}, x] && IGtQ[n, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 58, normalized size = 1.45 \begin {gather*} \frac {\sqrt {\left (1+x^2\right )^2} \left (\log \left (-1+\sqrt {2} x-x^2\right )-\log \left (1+\sqrt {2} x+x^2\right )\right )}{2 \sqrt {2} \left (1+x^2\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(78\) vs. \(2(34)=68\).
time = 0.43, size = 79, normalized size = 1.98

method result size
risch \(\frac {\sqrt {\left (x^{2}+1\right )^{2}}\, \sqrt {2}\, \ln \left (x^{2}-\sqrt {2}\, x +1\right )}{4 x^{2}+4}-\frac {\sqrt {\left (x^{2}+1\right )^{2}}\, \sqrt {2}\, \ln \left (x^{2}+\sqrt {2}\, x +1\right )}{4 \left (x^{2}+1\right )}\) \(67\)
default \(-\frac {\sqrt {\left (x^{2}+1\right )^{2}}\, \sqrt {2}\, \left (\ln \left (-\frac {x^{2}+\sqrt {2}\, x +1}{\sqrt {2}\, x -x^{2}-1}\right )-\ln \left (-\frac {\sqrt {2}\, x -x^{2}-1}{x^{2}+\sqrt {2}\, x +1}\right )\right )}{8 \left (x^{2}+1\right )}\) \(79\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.47, size = 34, normalized size = 0.85 \begin {gather*} -\frac {1}{4} \, \sqrt {2} \log \left (x^{2} + \sqrt {2} x + 1\right ) + \frac {1}{4} \, \sqrt {2} \log \left (x^{2} - \sqrt {2} x + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.34, size = 34, normalized size = 0.85 \begin {gather*} \frac {1}{4} \, \sqrt {2} \log \left (\frac {x^{4} + 4 \, x^{2} - 2 \, \sqrt {2} {\left (x^{3} + x\right )} + 1}{x^{4} + 1}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.05, size = 49, normalized size = 1.22 \begin {gather*} \frac {\sqrt {2} \log {\left (- \sqrt {2} x + \sqrt {\left (x^{2} + 1\right )^{2}} \right )}}{4} - \frac {\sqrt {2} \log {\left (\sqrt {2} x + \sqrt {\left (x^{2} + 1\right )^{2}} \right )}}{4} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.09, size = 18, normalized size = 0.45 \begin {gather*} -\frac {\sqrt {2}\,\mathrm {atanh}\left (\frac {\sqrt {2}\,x}{x^2+1}\right )}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________