\(\int \frac {1+x-2 x^2+x^3}{4+5 x^2+x^4} \, dx\) [319]

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

[Out]

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

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {1687, 1180, 209, 1261, 640, 31} \[ \int \frac {1+x-2 x^2+x^3}{4+5 x^2+x^4} \, dx=-\frac {3}{2} \arctan \left (\frac {x}{2}\right )+\arctan (x)+\frac {1}{2} \log \left (x^2+4\right ) \]

[In]

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

[Out]

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

Rule 31

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

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 640

Int[((d_) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[(d + e*x)^(m + p)*(a
/d + (c/e)*x)^p, x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && EqQ[c*d^2 - b*d*e + a*e^2, 0] &&
 IntegerQ[p]

Rule 1180

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Di
st[e/2 + (2*c*d - b*e)/(2*q), Int[1/(b/2 - q/2 + c*x^2), x], x] + Dist[e/2 - (2*c*d - b*e)/(2*q), Int[1/(b/2 +
 q/2 + c*x^2), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - a*e^2, 0] && PosQ[b^
2 - 4*a*c]

Rule 1261

Int[(x_)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_.), x_Symbol] :> Dist[1/2, Subst[
Int[(d + e*x)^q*(a + b*x + c*x^2)^p, x], x, x^2], x] /; FreeQ[{a, b, c, d, e, p, q}, x]

Rule 1687

Int[(Pq_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Module[{q = Expon[Pq, x], k}, Int[Sum[Coeff[
Pq, x, 2*k]*x^(2*k), {k, 0, q/2}]*(a + b*x^2 + c*x^4)^p, x] + Int[x*Sum[Coeff[Pq, x, 2*k + 1]*x^(2*k), {k, 0,
(q - 1)/2}]*(a + b*x^2 + c*x^4)^p, x]] /; FreeQ[{a, b, c, p}, x] && PolyQ[Pq, x] &&  !PolyQ[Pq, x^2]

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

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.07 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.78

method result size
default \(-\frac {3 \arctan \left (\frac {x}{2}\right )}{2}+\arctan \left (x \right )+\frac {\ln \left (x^{2}+4\right )}{2}\) \(18\)
risch \(-\frac {3 \arctan \left (\frac {x}{2}\right )}{2}+\arctan \left (x \right )+\frac {\ln \left (x^{2}+4\right )}{2}\) \(18\)
parallelrisch \(\frac {\ln \left (x -2 i\right )}{2}+\frac {3 i \ln \left (x -2 i\right )}{4}-\frac {i \ln \left (x -i\right )}{2}+\frac {i \ln \left (x +i\right )}{2}+\frac {\ln \left (x +2 i\right )}{2}-\frac {3 i \ln \left (x +2 i\right )}{4}\) \(48\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

integrate((x**3-2*x**2+x+1)/(x**4+5*x**2+4),x)

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.43 \[ \int \frac {1+x-2 x^2+x^3}{4+5 x^2+x^4} \, dx=-\mathrm {atan}\left (\frac {1305}{4\,\left (144\,x-162\right )}+\frac {9}{8}\right )+\ln \left (x-2{}\mathrm {i}\right )\,\left (\frac {1}{2}+\frac {3}{4}{}\mathrm {i}\right )+\ln \left (x+2{}\mathrm {i}\right )\,\left (\frac {1}{2}-\frac {3}{4}{}\mathrm {i}\right ) \]

[In]

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

[Out]

log(x - 2i)*(1/2 + 3i/4) + log(x + 2i)*(1/2 - 3i/4) - atan(1305/(4*(144*x - 162)) + 9/8)