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

   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 = 16, antiderivative size = 22 \[ \int \frac {4+4 x}{x^2 \left (1+x^2\right )} \, dx=-\frac {4}{x}-4 \arctan (x)+4 \log (x)-2 \log \left (1+x^2\right ) \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {815, 649, 209, 266} \[ \int \frac {4+4 x}{x^2 \left (1+x^2\right )} \, dx=-4 \arctan (x)-2 \log \left (x^2+1\right )-\frac {4}{x}+4 \log (x) \]

[In]

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

[Out]

-4/x - 4*ArcTan[x] + 4*Log[x] - 2*Log[1 + x^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 815

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
d + e*x)^m*((f + g*x)/(a + c*x^2)), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

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

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.09 \[ \int \frac {4+4 x}{x^2 \left (1+x^2\right )} \, dx=4 \left (-\frac {1}{x}-\arctan (x)+\log (x)-\frac {1}{2} \log \left (1+x^2\right )\right ) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.77 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.05

method result size
default \(-\frac {4}{x}-4 \arctan \left (x \right )+4 \ln \left (x \right )-2 \ln \left (x^{2}+1\right )\) \(23\)
meijerg \(-\frac {4}{x}-4 \arctan \left (x \right )+4 \ln \left (x \right )-2 \ln \left (x^{2}+1\right )\) \(23\)
risch \(-\frac {4}{x}-4 \arctan \left (x \right )+4 \ln \left (x \right )-2 \ln \left (x^{2}+1\right )\) \(23\)
parallelrisch \(\frac {2 i \ln \left (x -i\right ) x -2 i \ln \left (x +i\right ) x +4 \ln \left (x \right ) x -2 \ln \left (x -i\right ) x -2 \ln \left (x +i\right ) x -4}{x}\) \(46\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.91 \[ \int \frac {4+4 x}{x^2 \left (1+x^2\right )} \, dx=4 \log {\left (x \right )} - 2 \log {\left (x^{2} + 1 \right )} - 4 \operatorname {atan}{\left (x \right )} - \frac {4}{x} \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.05 \[ \int \frac {4+4 x}{x^2 \left (1+x^2\right )} \, dx=-\frac {4}{x} - 4 \, \arctan \left (x\right ) - 2 \, \log \left (x^{2} + 1\right ) + 4 \, \log \left ({\left | x \right |}\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.02 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.27 \[ \int \frac {4+4 x}{x^2 \left (1+x^2\right )} \, dx=4\,\ln \left (x\right )-\frac {4}{x}+\ln \left (x-\mathrm {i}\right )\,\left (-2+2{}\mathrm {i}\right )+\ln \left (x+1{}\mathrm {i}\right )\,\left (-2-2{}\mathrm {i}\right ) \]

[In]

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

[Out]

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