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

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

[Out]

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

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {1607, 1816, 649, 209, 266} \[ \int \frac {2 x+x^4}{1+x^2} \, dx=\arctan (x)+\frac {x^3}{3}+\log \left (x^2+1\right )-x \]

[In]

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

[Out]

-x + x^3/3 + ArcTan[x] + 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 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 1816

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

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

Mathematica [A] (verified)

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

[In]

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

[Out]

-x + x^3/3 + ArcTan[x] + Log[1 + x^2]

Maple [A] (verified)

Time = 0.72 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.95

method result size
default \(-x +\frac {x^{3}}{3}+\arctan \left (x \right )+\ln \left (x^{2}+1\right )\) \(18\)
risch \(-x +\frac {x^{3}}{3}+\arctan \left (x \right )+\ln \left (x^{2}+1\right )\) \(18\)
meijerg \(-\frac {x \left (-5 x^{2}+15\right )}{15}+\arctan \left (x \right )+\ln \left (x^{2}+1\right )\) \(20\)
parallelrisch \(\frac {x^{3}}{3}-x +\ln \left (x -i\right )-\frac {i \ln \left (x -i\right )}{2}+\ln \left (x +i\right )+\frac {i \ln \left (x +i\right )}{2}\) \(36\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 9.58 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {2 x+x^4}{1+x^2} \, dx=\ln \left (x^2+1\right )-x+\mathrm {atan}\left (x\right )+\frac {x^3}{3} \]

[In]

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

[Out]

log(x^2 + 1) - x + atan(x) + x^3/3