3.289 \(\int \frac {2+x}{(1+x^2) (4+x^2)} \, dx\)

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {1010, 391, 203, 444, 36, 31} \[ \frac {1}{6} \log \left (x^2+1\right )-\frac {1}{6} \log \left (x^2+4\right )-\frac {1}{3} \tan ^{-1}\left (\frac {x}{2}\right )+\frac {2}{3} \tan ^{-1}(x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 31

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

Rule 36

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

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 391

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

Rule 444

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

Rule 1010

Int[((g_) + (h_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_)*((d_) + (f_.)*(x_)^2)^(q_), x_Symbol] :> Dist[g, Int[(a + c
*x^2)^p*(d + f*x^2)^q, x], x] + Dist[h, Int[x*(a + c*x^2)^p*(d + f*x^2)^q, x], x] /; FreeQ[{a, c, d, f, g, h,
p, q}, x]

Rubi steps

\begin {align*} \int \frac {2+x}{\left (1+x^2\right ) \left (4+x^2\right )} \, dx &=2 \int \frac {1}{\left (1+x^2\right ) \left (4+x^2\right )} \, dx+\int \frac {x}{\left (1+x^2\right ) \left (4+x^2\right )} \, dx\\ &=\frac {1}{2} \operatorname {Subst}\left (\int \frac {1}{(1+x) (4+x)} \, dx,x,x^2\right )+\frac {2}{3} \int \frac {1}{1+x^2} \, dx-\frac {2}{3} \int \frac {1}{4+x^2} \, dx\\ &=-\frac {1}{3} \tan ^{-1}\left (\frac {x}{2}\right )+\frac {2}{3} \tan ^{-1}(x)+\frac {1}{6} \operatorname {Subst}\left (\int \frac {1}{1+x} \, dx,x,x^2\right )-\frac {1}{6} \operatorname {Subst}\left (\int \frac {1}{4+x} \, dx,x,x^2\right )\\ &=-\frac {1}{3} \tan ^{-1}\left (\frac {x}{2}\right )+\frac {2}{3} \tan ^{-1}(x)+\frac {1}{6} \log \left (1+x^2\right )-\frac {1}{6} \log \left (4+x^2\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.01, size = 37, normalized size = 1.00 \[ \frac {1}{6} \log \left (x^2+1\right )-\frac {1}{6} \log \left (x^2+4\right )-\frac {1}{3} \tan ^{-1}\left (\frac {x}{2}\right )+\frac {2}{3} \tan ^{-1}(x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.75, size = 27, normalized size = 0.73 \[ -\frac {1}{3} \, \arctan \left (\frac {1}{2} \, x\right ) + \frac {2}{3} \, \arctan \relax (x) - \frac {1}{6} \, \log \left (x^{2} + 4\right ) + \frac {1}{6} \, \log \left (x^{2} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.29, size = 27, normalized size = 0.73 \[ -\frac {1}{3} \, \arctan \left (\frac {1}{2} \, x\right ) + \frac {2}{3} \, \arctan \relax (x) - \frac {1}{6} \, \log \left (x^{2} + 4\right ) + \frac {1}{6} \, \log \left (x^{2} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.00, size = 28, normalized size = 0.76 \[ \frac {2 \arctan \relax (x )}{3}-\frac {\arctan \left (\frac {x}{2}\right )}{3}+\frac {\ln \left (x^{2}+1\right )}{6}-\frac {\ln \left (x^{2}+4\right )}{6} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 2.00, size = 27, normalized size = 0.73 \[ -\frac {1}{3} \, \arctan \left (\frac {1}{2} \, x\right ) + \frac {2}{3} \, \arctan \relax (x) - \frac {1}{6} \, \log \left (x^{2} + 4\right ) + \frac {1}{6} \, \log \left (x^{2} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 2.14, size = 37, normalized size = 1.00 \[ \ln \left (x-\mathrm {i}\right )\,\left (\frac {1}{6}-\frac {1}{3}{}\mathrm {i}\right )+\ln \left (x+1{}\mathrm {i}\right )\,\left (\frac {1}{6}+\frac {1}{3}{}\mathrm {i}\right )+\ln \left (x-2{}\mathrm {i}\right )\,\left (-\frac {1}{6}+\frac {1}{6}{}\mathrm {i}\right )+\ln \left (x+2{}\mathrm {i}\right )\,\left (-\frac {1}{6}-\frac {1}{6}{}\mathrm {i}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(x - 1i)*(1/6 - 1i/3) + log(x + 1i)*(1/6 + 1i/3) - log(x - 2i)*(1/6 - 1i/6) - log(x + 2i)*(1/6 + 1i/6)

________________________________________________________________________________________

sympy [A]  time = 0.17, size = 29, normalized size = 0.78 \[ \frac {\log {\left (x^{2} + 1 \right )}}{6} - \frac {\log {\left (x^{2} + 4 \right )}}{6} - \frac {\operatorname {atan}{\left (\frac {x}{2} \right )}}{3} + \frac {2 \operatorname {atan}{\relax (x )}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________