3.3.7 \(\int \frac {-4+6 x-x^2+3 x^3}{(1+x^2) (2+x^2)} \, dx\) [207]

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

[Out]

-3*arctan(x)+3/2*ln(x^2+1)+arctan(1/2*x*2^(1/2))*2^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.08, antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {6857, 649, 209, 266} \begin {gather*} -3 \text {ArcTan}(x)+\sqrt {2} \text {ArcTan}\left (\frac {x}{\sqrt {2}}\right )+\frac {3}{2} \log \left (x^2+1\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-3*ArcTan[x] + Sqrt[2]*ArcTan[x/Sqrt[2]] + (3*Log[1 + x^2])/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 266

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 649

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[(-a)*c]

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

________________________________________________________________________________________

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

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.06, size = 25, normalized size = 0.86

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-3*arctan(x)+3/2*ln(x^2+1)+arctan(1/2*x*2^(1/2))*2^(1/2)

________________________________________________________________________________________

Maxima [A]
time = 2.33, size = 24, normalized size = 0.83 \begin {gather*} \sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) - 3 \, \arctan \left (x\right ) + \frac {3}{2} \, \log \left (x^{2} + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 1.21, size = 24, normalized size = 0.83 \begin {gather*} \sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) - 3 \, \arctan \left (x\right ) + \frac {3}{2} \, \log \left (x^{2} + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.08, size = 29, normalized size = 1.00 \begin {gather*} \frac {3 \log {\left (x^{2} + 1 \right )}}{2} - 3 \operatorname {atan}{\left (x \right )} + \sqrt {2} \operatorname {atan}{\left (\frac {\sqrt {2} x}{2} \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.45, size = 24, normalized size = 0.83 \begin {gather*} \sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) - 3 \, \arctan \left (x\right ) + \frac {3}{2} \, \log \left (x^{2} + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.07, size = 51, normalized size = 1.76 \begin {gather*} -\sqrt {2}\,\mathrm {atan}\left (\frac {24\,\sqrt {2}}{24\,x-64}+\frac {32\,\sqrt {2}\,x}{24\,x-64}\right )+\ln \left (x-\mathrm {i}\right )\,\left (\frac {3}{2}+\frac {3}{2}{}\mathrm {i}\right )+\ln \left (x+1{}\mathrm {i}\right )\,\left (\frac {3}{2}-\frac {3}{2}{}\mathrm {i}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(x - 1i)*(3/2 + 3i/2) + log(x + 1i)*(3/2 - 3i/2) - 2^(1/2)*atan((24*2^(1/2))/(24*x - 64) + (32*2^(1/2)*x)/(
24*x - 64))

________________________________________________________________________________________