\(\int \frac {4+x^2}{(1+x^2) (2+x^2)} \, dx\) [281]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 20, antiderivative size = 20 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=3 \arctan (x)-\sqrt {2} \arctan \left (\frac {x}{\sqrt {2}}\right ) \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {536, 209} \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=3 \arctan (x)-\sqrt {2} \arctan \left (\frac {x}{\sqrt {2}}\right ) \]

[In]

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

[Out]

3*ArcTan[x] - Sqrt[2]*ArcTan[x/Sqrt[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 536

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rubi steps \begin{align*} \text {integral}& = -\left (2 \int \frac {1}{2+x^2} \, dx\right )+3 \int \frac {1}{1+x^2} \, dx \\ & = 3 \tan ^{-1}(x)-\sqrt {2} \tan ^{-1}\left (\frac {x}{\sqrt {2}}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=3 \arctan (x)-\sqrt {2} \arctan \left (\frac {x}{\sqrt {2}}\right ) \]

[In]

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

[Out]

3*ArcTan[x] - Sqrt[2]*ArcTan[x/Sqrt[2]]

Maple [A] (verified)

Time = 0.77 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.90

method result size
default \(3 \arctan \left (x \right )-\arctan \left (\frac {x \sqrt {2}}{2}\right ) \sqrt {2}\) \(18\)
risch \(3 \arctan \left (x \right )-\arctan \left (\frac {x \sqrt {2}}{2}\right ) \sqrt {2}\) \(18\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.85 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=-\sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) + 3 \, \arctan \left (x\right ) \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.95 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=3 \operatorname {atan}{\left (x \right )} - \sqrt {2} \operatorname {atan}{\left (\frac {\sqrt {2} x}{2} \right )} \]

[In]

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

[Out]

3*atan(x) - sqrt(2)*atan(sqrt(2)*x/2)

Maxima [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.85 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=-\sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) + 3 \, \arctan \left (x\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.85 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=-\sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) + 3 \, \arctan \left (x\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.85 \[ \int \frac {4+x^2}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx=3\,\mathrm {atan}\left (x\right )-\sqrt {2}\,\mathrm {atan}\left (\frac {\sqrt {2}\,x}{2}\right ) \]

[In]

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

[Out]

3*atan(x) - 2^(1/2)*atan((2^(1/2)*x)/2)