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

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

[Out]

-1/2*arctanh(1/2*x)+ln(4+x)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {1607, 1643, 213} \[ \int \frac {x+x^2}{(4+x) \left (-4+x^2\right )} \, dx=\log (x+4)-\frac {1}{2} \text {arctanh}\left (\frac {x}{2}\right ) \]

[In]

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

[Out]

-1/2*ArcTanh[x/2] + Log[4 + x]

Rule 213

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

Rule 1607

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^(q - p))^n, x] /; F
reeQ[{a, b, p, q}, x] && IntegerQ[n] && PosQ[q - p]

Rule 1643

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*
Pq*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

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

Mathematica [A] (verified)

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

[In]

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

[Out]

Log[2 - x]/4 - Log[2 + x]/4 + Log[4 + x]

Maple [A] (verified)

Time = 0.79 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.20

method result size
default \(-\frac {\ln \left (x +2\right )}{4}+\ln \left (x +4\right )+\frac {\ln \left (x -2\right )}{4}\) \(18\)
norman \(-\frac {\ln \left (x +2\right )}{4}+\ln \left (x +4\right )+\frac {\ln \left (x -2\right )}{4}\) \(18\)
risch \(-\frac {\ln \left (x +2\right )}{4}+\ln \left (x +4\right )+\frac {\ln \left (x -2\right )}{4}\) \(18\)
parallelrisch \(-\frac {\ln \left (x +2\right )}{4}+\ln \left (x +4\right )+\frac {\ln \left (x -2\right )}{4}\) \(18\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \frac {x+x^2}{(4+x) \left (-4+x^2\right )} \, dx=\frac {\log {\left (x - 2 \right )}}{4} - \frac {\log {\left (x + 2 \right )}}{4} + \log {\left (x + 4 \right )} \]

[In]

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

[Out]

log(x - 2)/4 - log(x + 2)/4 + log(x + 4)

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.27 \[ \int \frac {x+x^2}{(4+x) \left (-4+x^2\right )} \, dx=\ln \left (x+4\right )+\frac {\mathrm {atanh}\left (\frac {90}{7\,\left (21\,x+48\right )}-\frac {8}{7}\right )}{2} \]

[In]

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

[Out]

log(x + 4) + atanh(90/(7*(21*x + 48)) - 8/7)/2