3.253 \(\int \frac{5+x+3 x^2+2 x^3}{2+x+5 x^2+x^3+2 x^4} \, dx\)

Optimal. Leaf size=198 \[ \frac{1}{28} \left (7+5 i \sqrt{7}\right ) \log \left (4 x^2+\left (1-i \sqrt{7}\right ) x+4\right )+\frac{1}{28} \left (7-5 i \sqrt{7}\right ) \log \left (4 x^2+\left (1+i \sqrt{7}\right ) x+4\right )+\frac{\left (7 \sqrt{7}+19 i\right ) \tan ^{-1}\left (\frac{8 x-i \sqrt{7}+1}{\sqrt{2 \left (35+i \sqrt{7}\right )}}\right )}{\sqrt{14 \left (35+i \sqrt{7}\right )}}-\frac{\left (-7 \sqrt{7}+19 i\right ) \tan ^{-1}\left (\frac{8 x+i \sqrt{7}+1}{\sqrt{2 \left (35-i \sqrt{7}\right )}}\right )}{\sqrt{14 \left (35-i \sqrt{7}\right )}} \]

[Out]

((19*I + 7*Sqrt[7])*ArcTan[(1 - I*Sqrt[7] + 8*x)/Sqrt[2*(35 + I*Sqrt[7])]])/Sqrt[14*(35 + I*Sqrt[7])] - ((19*I
 - 7*Sqrt[7])*ArcTan[(1 + I*Sqrt[7] + 8*x)/Sqrt[2*(35 - I*Sqrt[7])]])/Sqrt[14*(35 - I*Sqrt[7])] + ((7 + (5*I)*
Sqrt[7])*Log[4 + (1 - I*Sqrt[7])*x + 4*x^2])/28 + ((7 - (5*I)*Sqrt[7])*Log[4 + (1 + I*Sqrt[7])*x + 4*x^2])/28

________________________________________________________________________________________

Rubi [A]  time = 0.194412, antiderivative size = 198, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 5, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.156, Rules used = {2086, 634, 618, 204, 628} \[ \frac{1}{28} \left (7+5 i \sqrt{7}\right ) \log \left (4 x^2+\left (1-i \sqrt{7}\right ) x+4\right )+\frac{1}{28} \left (7-5 i \sqrt{7}\right ) \log \left (4 x^2+\left (1+i \sqrt{7}\right ) x+4\right )+\frac{\left (7 \sqrt{7}+19 i\right ) \tan ^{-1}\left (\frac{8 x-i \sqrt{7}+1}{\sqrt{2 \left (35+i \sqrt{7}\right )}}\right )}{\sqrt{14 \left (35+i \sqrt{7}\right )}}-\frac{\left (-7 \sqrt{7}+19 i\right ) \tan ^{-1}\left (\frac{8 x+i \sqrt{7}+1}{\sqrt{2 \left (35-i \sqrt{7}\right )}}\right )}{\sqrt{14 \left (35-i \sqrt{7}\right )}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

((19*I + 7*Sqrt[7])*ArcTan[(1 - I*Sqrt[7] + 8*x)/Sqrt[2*(35 + I*Sqrt[7])]])/Sqrt[14*(35 + I*Sqrt[7])] - ((19*I
 - 7*Sqrt[7])*ArcTan[(1 + I*Sqrt[7] + 8*x)/Sqrt[2*(35 - I*Sqrt[7])]])/Sqrt[14*(35 - I*Sqrt[7])] + ((7 + (5*I)*
Sqrt[7])*Log[4 + (1 - I*Sqrt[7])*x + 4*x^2])/28 + ((7 - (5*I)*Sqrt[7])*Log[4 + (1 + I*Sqrt[7])*x + 4*x^2])/28

Rule 2086

Int[(P3_)/((a_) + (b_.)*(x_) + (c_.)*(x_)^2 + (d_.)*(x_)^3 + (e_.)*(x_)^4), x_Symbol] :> With[{q = Sqrt[8*a^2
+ b^2 - 4*a*c], A = Coeff[P3, x, 0], B = Coeff[P3, x, 1], C = Coeff[P3, x, 2], D = Coeff[P3, x, 3]}, Dist[1/q,
 Int[(b*A - 2*a*B + 2*a*D + A*q + (2*a*A - 2*a*C + b*D + D*q)*x)/(2*a + (b + q)*x + 2*a*x^2), x], x] - Dist[1/
q, Int[(b*A - 2*a*B + 2*a*D - A*q + (2*a*A - 2*a*C + b*D - D*q)*x)/(2*a + (b - q)*x + 2*a*x^2), x], x]] /; Fre
eQ[{a, b, c}, x] && PolyQ[P3, x, 3] && EqQ[a, e] && EqQ[b, d]

Rule 634

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

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

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

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

\begin{align*} \int \frac{5+x+3 x^2+2 x^3}{2+x+5 x^2+x^3+2 x^4} \, dx &=\frac{i \int \frac{9-5 i \sqrt{7}+\left (10-2 i \sqrt{7}\right ) x}{4+\left (1-i \sqrt{7}\right ) x+4 x^2} \, dx}{\sqrt{7}}-\frac{i \int \frac{9+5 i \sqrt{7}+\left (10+2 i \sqrt{7}\right ) x}{4+\left (1+i \sqrt{7}\right ) x+4 x^2} \, dx}{\sqrt{7}}\\ &=-\left (\frac{1}{28} \left (-7+5 i \sqrt{7}\right ) \int \frac{1+i \sqrt{7}+8 x}{4+\left (1+i \sqrt{7}\right ) x+4 x^2} \, dx\right )+\frac{1}{28} \left (7+5 i \sqrt{7}\right ) \int \frac{1-i \sqrt{7}+8 x}{4+\left (1-i \sqrt{7}\right ) x+4 x^2} \, dx-\frac{1}{14} \left (-49+19 i \sqrt{7}\right ) \int \frac{1}{4+\left (1+i \sqrt{7}\right ) x+4 x^2} \, dx+\frac{1}{14} \left (49+19 i \sqrt{7}\right ) \int \frac{1}{4+\left (1-i \sqrt{7}\right ) x+4 x^2} \, dx\\ &=\frac{1}{28} \left (7+5 i \sqrt{7}\right ) \log \left (4+\left (1-i \sqrt{7}\right ) x+4 x^2\right )+\frac{1}{28} \left (7-5 i \sqrt{7}\right ) \log \left (4+\left (1+i \sqrt{7}\right ) x+4 x^2\right )-\frac{1}{7} \left (49-19 i \sqrt{7}\right ) \operatorname{Subst}\left (\int \frac{1}{-2 \left (35-i \sqrt{7}\right )-x^2} \, dx,x,1+i \sqrt{7}+8 x\right )-\frac{1}{7} \left (49+19 i \sqrt{7}\right ) \operatorname{Subst}\left (\int \frac{1}{-2 \left (35+i \sqrt{7}\right )-x^2} \, dx,x,1-i \sqrt{7}+8 x\right )\\ &=\frac{\left (19 i+7 \sqrt{7}\right ) \tan ^{-1}\left (\frac{1-i \sqrt{7}+8 x}{\sqrt{2 \left (35+i \sqrt{7}\right )}}\right )}{\sqrt{14 \left (35+i \sqrt{7}\right )}}-\frac{\left (19 i-7 \sqrt{7}\right ) \tan ^{-1}\left (\frac{1+i \sqrt{7}+8 x}{\sqrt{2 \left (35-i \sqrt{7}\right )}}\right )}{\sqrt{14 \left (35-i \sqrt{7}\right )}}+\frac{1}{28} \left (7+5 i \sqrt{7}\right ) \log \left (4+\left (1-i \sqrt{7}\right ) x+4 x^2\right )+\frac{1}{28} \left (7-5 i \sqrt{7}\right ) \log \left (4+\left (1+i \sqrt{7}\right ) x+4 x^2\right )\\ \end{align*}

Mathematica [C]  time = 0.0128284, size = 90, normalized size = 0.45 \[ \text{RootSum}\left [2 \text{$\#$1}^4+\text{$\#$1}^3+5 \text{$\#$1}^2+\text{$\#$1}+2\& ,\frac{2 \text{$\#$1}^3 \log (x-\text{$\#$1})+3 \text{$\#$1}^2 \log (x-\text{$\#$1})+\text{$\#$1} \log (x-\text{$\#$1})+5 \log (x-\text{$\#$1})}{8 \text{$\#$1}^3+3 \text{$\#$1}^2+10 \text{$\#$1}+1}\& \right ] \]

Antiderivative was successfully verified.

[In]

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

[Out]

RootSum[2 + #1 + 5*#1^2 + #1^3 + 2*#1^4 & , (5*Log[x - #1] + Log[x - #1]*#1 + 3*Log[x - #1]*#1^2 + 2*Log[x - #
1]*#1^3)/(1 + 10*#1 + 3*#1^2 + 8*#1^3) & ]

________________________________________________________________________________________

Maple [C]  time = 0.005, size = 58, normalized size = 0.3 \begin{align*} \sum _{{\it \_R}={\it RootOf} \left ( 2\,{{\it \_Z}}^{4}+{{\it \_Z}}^{3}+5\,{{\it \_Z}}^{2}+{\it \_Z}+2 \right ) }{\frac{ \left ( 2\,{{\it \_R}}^{3}+3\,{{\it \_R}}^{2}+{\it \_R}+5 \right ) \ln \left ( x-{\it \_R} \right ) }{8\,{{\it \_R}}^{3}+3\,{{\it \_R}}^{2}+10\,{\it \_R}+1}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

sum((2*_R^3+3*_R^2+_R+5)/(8*_R^3+3*_R^2+10*_R+1)*ln(x-_R),_R=RootOf(2*_Z^4+_Z^3+5*_Z^2+_Z+2))

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{2 \, x^{3} + 3 \, x^{2} + x + 5}{2 \, x^{4} + x^{3} + 5 \, x^{2} + x + 2}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 9.75783, size = 4867, normalized size = 24.58 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/28*(2*sqrt(7)*sqrt(-21*(5/28*I*sqrt(7) - 1/2*sqrt(-53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 21*(-5/28*I*sqrt(7) -
 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 1/56*(5*I*sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) + 21)*(-5*I*s
qrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) - 5/2*I*sqrt(7) - 7*sqrt(53/98*I*sqrt(7) - 1/14) - 27/2) - 7*sq
rt(53/98*I*sqrt(7) - 1/14) - 7*sqrt(-53/98*I*sqrt(7) - 1/14) - 7)*log(49/4*(105*I*sqrt(7) + 294*sqrt(53/98*I*s
qrt(7) - 1/14) + 253)*(5/28*I*sqrt(7) - 1/2*sqrt(-53/98*I*sqrt(7) - 1/14) + 1/4)^2 + 4900*(-5/28*I*sqrt(7) - 1
/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 + 1/16*(4116*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/
4)^2 + 735*I*sqrt(7) + 2058*sqrt(53/98*I*sqrt(7) - 1/14) + 11)*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14
) - 7) + 1/16*sqrt(-21*(5/28*I*sqrt(7) - 1/2*sqrt(-53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 21*(-5/28*I*sqrt(7) - 1/
2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 1/56*(5*I*sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) + 21)*(-5*I*sqrt
(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) - 5/2*I*sqrt(7) - 7*sqrt(53/98*I*sqrt(7) - 1/14) - 27/2)*((21*sqrt
(7)*(5*I*sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) - 7) + 400*sqrt(7))*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7
) - 1/14) - 7) + 400*sqrt(7)*(5*I*sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) - 7) + 7040*sqrt(7)) + 608*x + 325
*I*sqrt(7) + 910*sqrt(53/98*I*sqrt(7) - 1/14) - 1247) + 1/28*(2*sqrt(7)*sqrt(-21*(5/28*I*sqrt(7) - 1/2*sqrt(-5
3/98*I*sqrt(7) - 1/14) + 1/4)^2 - 21*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 1/56*(5*I*
sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) + 21)*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) - 5/2*I*
sqrt(7) - 7*sqrt(53/98*I*sqrt(7) - 1/14) - 27/2) + 7*sqrt(53/98*I*sqrt(7) - 1/14) + 7*sqrt(-53/98*I*sqrt(7) -
1/14) + 7)*log(49/4*(105*I*sqrt(7) + 294*sqrt(53/98*I*sqrt(7) - 1/14) + 253)*(5/28*I*sqrt(7) - 1/2*sqrt(-53/98
*I*sqrt(7) - 1/14) + 1/4)^2 + 4900*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 + 1/16*(4116*(
-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 + 735*I*sqrt(7) + 2058*sqrt(53/98*I*sqrt(7) - 1/14
) + 11)*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) - 1/16*sqrt(-21*(5/28*I*sqrt(7) - 1/2*sqrt(-53/9
8*I*sqrt(7) - 1/14) + 1/4)^2 - 21*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 1/56*(5*I*sqr
t(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) + 21)*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) - 5/2*I*sqr
t(7) - 7*sqrt(53/98*I*sqrt(7) - 1/14) - 27/2)*((21*sqrt(7)*(5*I*sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) - 7)
 + 400*sqrt(7))*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) + 400*sqrt(7)*(5*I*sqrt(7) + 14*sqrt(53/
98*I*sqrt(7) - 1/14) - 7) + 7040*sqrt(7)) + 608*x + 325*I*sqrt(7) + 910*sqrt(53/98*I*sqrt(7) - 1/14) - 1247) -
 1/28*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7)*log(-49/4*(105*I*sqrt(7) + 294*sqrt(53/98*I*sqrt(7
) - 1/14) + 253)*(5/28*I*sqrt(7) - 1/2*sqrt(-53/98*I*sqrt(7) - 1/14) + 1/4)^2 + 7203*(-5/28*I*sqrt(7) - 1/2*sq
rt(53/98*I*sqrt(7) - 1/14) + 1/4)^3 - 7203*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 - 1/16
*(4116*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^2 + 735*I*sqrt(7) + 2058*sqrt(53/98*I*sqrt(7
) - 1/14) + 11)*(-5*I*sqrt(7) + 14*sqrt(-53/98*I*sqrt(7) - 1/14) - 7) + 304*x - 2205/2*I*sqrt(7) - 3087*sqrt(5
3/98*I*sqrt(7) - 1/14) - 3025/2) - 1/28*(5*I*sqrt(7) + 14*sqrt(53/98*I*sqrt(7) - 1/14) - 7)*log(-7203*(-5/28*I
*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14) + 1/4)^3 + 2303*(-5/28*I*sqrt(7) - 1/2*sqrt(53/98*I*sqrt(7) - 1/14
) + 1/4)^2 + 304*x + 1555/2*I*sqrt(7) + 2177*sqrt(53/98*I*sqrt(7) - 1/14) + 5823/2)

________________________________________________________________________________________

Sympy [A]  time = 0.716795, size = 46, normalized size = 0.23 \begin{align*} \operatorname{RootSum}{\left (343 t^{4} - 343 t^{3} + 294 t^{2} - 336 t + 128, \left ( t \mapsto t \log{\left (- \frac{7203 t^{3}}{304} + \frac{2303 t^{2}}{304} - \frac{2177 t}{152} + x + \frac{250}{19} \right )} \right )\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

RootSum(343*_t**4 - 343*_t**3 + 294*_t**2 - 336*_t + 128, Lambda(_t, _t*log(-7203*_t**3/304 + 2303*_t**2/304 -
 2177*_t/152 + x + 250/19)))

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{2 \, x^{3} + 3 \, x^{2} + x + 5}{2 \, x^{4} + x^{3} + 5 \, x^{2} + x + 2}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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