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

   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 = 11 \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=-\log (x)+\log \left (2+x^2\right ) \]

[Out]

-ln(x)+ln(x^2+2)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 11, 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.125, Rules used = {457, 78} \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=\log \left (x^2+2\right )-\log (x) \]

[In]

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

[Out]

-Log[x] + Log[2 + x^2]

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(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] && IntegerQ[Simplify[(m + 1)/n]]

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

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=-\log (x)+\log \left (2+x^2\right ) \]

[In]

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

[Out]

-Log[x] + Log[2 + x^2]

Maple [A] (verified)

Time = 0.84 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.09

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

[In]

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

[Out]

-ln(x)+ln(x^2+2)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=\log \left (x^{2} + 2\right ) - \log \left (x\right ) \]

[In]

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

[Out]

log(x^2 + 2) - log(x)

Sympy [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.73 \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=- \log {\left (x \right )} + \log {\left (x^{2} + 2 \right )} \]

[In]

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

[Out]

-log(x) + log(x**2 + 2)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 13, normalized size of antiderivative = 1.18 \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=\log \left (x^{2} + 2\right ) - \frac {1}{2} \, \log \left (x^{2}\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \frac {-2+x^2}{x \left (2+x^2\right )} \, dx=\ln \left (x^2+2\right )-\ln \left (x\right ) \]

[In]

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

[Out]

log(x^2 + 2) - log(x)