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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 46, normalized size of antiderivative = 0.79, number of steps used = 6, number of rules used = 6, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {1701, 1712, 209, 1261, 738, 212} \begin {gather*} \frac {1}{2} \tanh ^{-1}\left (\frac {1-x^2}{2 \sqrt {x^4+x^2+1}}\right )-2 \text {ArcTan}\left (\frac {x}{\sqrt {x^4+x^2+1}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

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 738

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

Rule 1261

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

Rule 1701

Int[(Pr_)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Module[{r = Expo
n[Pr, x], k}, Int[Sum[Coeff[Pr, x, 2*k]*x^(2*k), {k, 0, r/2}]*(d + e*x^2)^q*(a + b*x^2 + c*x^4)^p, x] + Int[x*
Sum[Coeff[Pr, x, 2*k + 1]*x^(2*k), {k, 0, (r - 1)/2}]*(d + e*x^2)^q*(a + b*x^2 + c*x^4)^p, x]] /; FreeQ[{a, b,
 c, d, e, p, q}, x] && PolyQ[Pr, x] &&  !PolyQ[Pr, x^2]

Rule 1712

Int[((A_) + (B_.)*(x_)^2)/(((d_) + (e_.)*(x_)^2)*Sqrt[(a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4]), x_Symbol] :> Dist[
A, Subst[Int[1/(d - (b*d - 2*a*e)*x^2), x], x, x/Sqrt[a + b*x^2 + c*x^4]], x] /; FreeQ[{a, b, c, d, e, A, B},
x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && EqQ[c*d^2 - a*e^2, 0] && EqQ[B*d + A*e, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.33, size = 58, normalized size = 1.00 \begin {gather*} -2 \text {ArcTan}\left (\frac {x}{\sqrt {1+x^2+x^4}}\right )+\frac {1}{2} \tanh ^{-1}\left (\frac {2 x^2}{1+2 x^2+x^4+\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 1.95, size = 219, normalized size = 3.78

method result size
elliptic \(\frac {\arctanh \left (\frac {-x^{2}+1}{2 \sqrt {\left (x^{2}+1\right )^{2}-x^{2}}}\right )}{2}+2 \arctan \left (\frac {\sqrt {x^{4}+x^{2}+1}}{x}\right )\) \(46\)
trager \(-\frac {\ln \left (-\frac {6 \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) x -8 x^{2}+4 \sqrt {x^{4}+x^{2}+1}-3 x +8}{\left (2 \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) x -x +4\right )^{2}}\right ) \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right )}{2}+\frac {\ln \left (-\frac {6 \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) x -8 x^{2}+4 \sqrt {x^{4}+x^{2}+1}-3 x +8}{\left (2 \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) x -x +4\right )^{2}}\right )}{2}+\frac {\RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) \ln \left (-\frac {-6 \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) x -8 x^{2}+4 \sqrt {x^{4}+x^{2}+1}+3 x +8}{\left (2 \RootOf \left (4 \textit {\_Z}^{2}-4 \textit {\_Z} +17\right ) x -x -4\right )^{2}}\right )}{2}\) \(210\)
default \(\frac {4 \sqrt {1-\left (-\frac {1}{2}+\frac {i \sqrt {3}}{2}\right ) x^{2}}\, \sqrt {1-\left (-\frac {1}{2}-\frac {i \sqrt {3}}{2}\right ) x^{2}}\, \EllipticF \left (\frac {x \sqrt {-2+2 i \sqrt {3}}}{2}, \frac {\sqrt {-2+2 i \sqrt {3}}}{2}\right )}{\sqrt {-2+2 i \sqrt {3}}\, \sqrt {x^{4}+x^{2}+1}}-\frac {\arctanh \left (\frac {x^{2}}{2 \sqrt {x^{4}+x^{2}+1}}-\frac {1}{2 \sqrt {x^{4}+x^{2}+1}}\right )}{2}-\frac {4 \sqrt {1+\frac {x^{2}}{2}-\frac {i x^{2} \sqrt {3}}{2}}\, \sqrt {1+\frac {x^{2}}{2}+\frac {i x^{2} \sqrt {3}}{2}}\, \EllipticPi \left (\sqrt {-\frac {1}{2}+\frac {i \sqrt {3}}{2}}\, x , -\frac {1}{-\frac {1}{2}+\frac {i \sqrt {3}}{2}}, \frac {\sqrt {-\frac {1}{2}-\frac {i \sqrt {3}}{2}}}{\sqrt {-\frac {1}{2}+\frac {i \sqrt {3}}{2}}}\right )}{\sqrt {-\frac {1}{2}+\frac {i \sqrt {3}}{2}}\, \sqrt {x^{4}+x^{2}+1}}\) \(219\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

4/(-2+2*I*3^(1/2))^(1/2)*(1-(-1/2+1/2*I*3^(1/2))*x^2)^(1/2)*(1-(-1/2-1/2*I*3^(1/2))*x^2)^(1/2)/(x^4+x^2+1)^(1/
2)*EllipticF(1/2*x*(-2+2*I*3^(1/2))^(1/2),1/2*(-2+2*I*3^(1/2))^(1/2))-1/2*arctanh(1/2/(x^4+x^2+1)^(1/2)*x^2-1/
2/(x^4+x^2+1)^(1/2))-4/(-1/2+1/2*I*3^(1/2))^(1/2)*(1+1/2*x^2-1/2*I*x^2*3^(1/2))^(1/2)*(1+1/2*x^2+1/2*I*x^2*3^(
1/2))^(1/2)/(x^4+x^2+1)^(1/2)*EllipticPi((-1/2+1/2*I*3^(1/2))^(1/2)*x,-1/(-1/2+1/2*I*3^(1/2)),(-1/2-1/2*I*3^(1
/2))^(1/2)/(-1/2+1/2*I*3^(1/2))^(1/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((2*x^2-x-2)/(x^2+1)/(x^4+x^2+1)^(1/2),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.45, size = 63, normalized size = 1.09 \begin {gather*} 2 \, \arctan \left (\frac {\sqrt {x^{4} + x^{2} + 1}}{x}\right ) + \frac {1}{4} \, \log \left (\frac {5 \, x^{4} + 2 \, x^{2} - 4 \, \sqrt {x^{4} + x^{2} + 1} {\left (x^{2} - 1\right )} + 5}{x^{4} + 2 \, x^{2} + 1}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________