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

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [C] (verified)
Fricas [B] (verification not implemented)
Sympy [B] (verification not implemented)
Maxima [F]
Giac [F]
Mupad [B] (verification not implemented)
Reduce [F]

Optimal result

Integrand size = 35, antiderivative size = 219 \[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=x+\frac {x^2}{2}+\frac {\left (53+i \sqrt {7}\right ) \text {arctanh}\left (\frac {i-\sqrt {7}+8 i x}{\sqrt {2 \left (35-i \sqrt {7}\right )}}\right )}{2 \sqrt {14 \left (35-i \sqrt {7}\right )}}-\frac {\left (53-i \sqrt {7}\right ) \text {arctanh}\left (\frac {i+\sqrt {7}+8 i x}{\sqrt {2 \left (35+i \sqrt {7}\right )}}\right )}{2 \sqrt {14 \left (35+i \sqrt {7}\right )}}-\frac {1}{56} \left (35-9 i \sqrt {7}\right ) \log \left (4 i+\left (i-\sqrt {7}\right ) x+4 i x^2\right )-\frac {1}{56} \left (35+9 i \sqrt {7}\right ) \log \left (4 i+\left (i+\sqrt {7}\right ) x+4 i x^2\right ) \] Output:

x+1/2*x^2+1/2*(53+I*7^(1/2))*arctanh((I-7^(1/2)+8*I*x)/(70-2*I*7^(1/2))^(1 
/2))/(490-14*I*7^(1/2))^(1/2)-1/2*(53-I*7^(1/2))*arctanh((I+7^(1/2)+8*I*x) 
/(70+2*I*7^(1/2))^(1/2))/(490+14*I*7^(1/2))^(1/2)-1/56*(35-9*I*7^(1/2))*ln 
(4*I+(I-7^(1/2))*x+4*I*x^2)-1/56*(35+9*I*7^(1/2))*ln(4*I+(I+7^(1/2))*x+4*I 
*x^2)
 

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3 in optimal.

Time = 0.02 (sec) , antiderivative size = 101, normalized size of antiderivative = 0.46 \[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=x+\frac {x^2}{2}-\text {RootSum}\left [2+\text {$\#$1}+5 \text {$\#$1}^2+\text {$\#$1}^3+2 \text {$\#$1}^4\&,\frac {2 \log (x-\text {$\#$1})+3 \log (x-\text {$\#$1}) \text {$\#$1}+\log (x-\text {$\#$1}) \text {$\#$1}^2+5 \log (x-\text {$\#$1}) \text {$\#$1}^3}{1+10 \text {$\#$1}+3 \text {$\#$1}^2+8 \text {$\#$1}^3}\&\right ] \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.99 (sec) , antiderivative size = 216, normalized size of antiderivative = 0.99, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.057, Rules used = {2492, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

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

\(\Big \downarrow \) 2492

\(\displaystyle \frac {1}{2} \int \left (2 x-\frac {2 \left (\left (9+5 i \sqrt {7}\right ) x+2 \left (5+i \sqrt {7}\right )\right )}{\sqrt {7} \left (4 i x^2+\left (i-\sqrt {7}\right ) x+4 i\right )}-\frac {2 \left (\left (35 i-9 \sqrt {7}\right ) x+2 \left (7 i-5 \sqrt {7}\right )\right )}{7 \left (4 i x^2+\left (i+\sqrt {7}\right ) x+4 i\right )}+2\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {1}{2} \left (\frac {\left (53+i \sqrt {7}\right ) \text {arctanh}\left (\frac {8 i x-\sqrt {7}+i}{\sqrt {2 \left (35-i \sqrt {7}\right )}}\right )}{\sqrt {14 \left (35-i \sqrt {7}\right )}}-\frac {\left (53-i \sqrt {7}\right ) \text {arctanh}\left (\frac {8 i x+\sqrt {7}+i}{\sqrt {2 \left (35+i \sqrt {7}\right )}}\right )}{\sqrt {14 \left (35+i \sqrt {7}\right )}}+x^2-\frac {1}{28} \left (35-9 i \sqrt {7}\right ) \log \left (4 i x^2+\left (-\sqrt {7}+i\right ) x+4 i\right )-\frac {1}{28} \left (35+9 i \sqrt {7}\right ) \log \left (4 i x^2+\left (\sqrt {7}+i\right ) x+4 i\right )+2 x\right )\)

Input:

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

Output:

(2*x + x^2 + ((53 + I*Sqrt[7])*ArcTanh[(I - Sqrt[7] + (8*I)*x)/Sqrt[2*(35 
- I*Sqrt[7])]])/Sqrt[14*(35 - I*Sqrt[7])] - ((53 - I*Sqrt[7])*ArcTanh[(I + 
 Sqrt[7] + (8*I)*x)/Sqrt[2*(35 + I*Sqrt[7])]])/Sqrt[14*(35 + I*Sqrt[7])] - 
 ((35 - (9*I)*Sqrt[7])*Log[4*I + (I - Sqrt[7])*x + (4*I)*x^2])/28 - ((35 + 
 (9*I)*Sqrt[7])*Log[4*I + (I + Sqrt[7])*x + (4*I)*x^2])/28)/2
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2492
Int[(Px_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2 + (d_.)*(x_)^3 + (e_.)*(x_)^4) 
^(p_), x_Symbol] :> Simp[e^p   Int[ExpandIntegrand[Px*(b/d + ((d + Sqrt[e*( 
(b^2 - 4*a*c)/a) + 8*a*d*(e/b)])/(2*e))*x + x^2)^p*(b/d + ((d - Sqrt[e*((b^ 
2 - 4*a*c)/a) + 8*a*d*(e/b)])/(2*e))*x + x^2)^p, x], x], x] /; FreeQ[{a, b, 
 c, d, e}, x] && PolyQ[Px, x] && ILtQ[p, 0] && EqQ[a*d^2 - b^2*e, 0]
 
Maple [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 0.04 (sec) , antiderivative size = 67, normalized size of antiderivative = 0.31

method result size
default \(\frac {x^{2}}{2}+x +\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (2 \textit {\_Z}^{4}+\textit {\_Z}^{3}+5 \textit {\_Z}^{2}+\textit {\_Z} +2\right )}{\sum }\frac {\left (-5 \textit {\_R}^{3}-\textit {\_R}^{2}-3 \textit {\_R} -2\right ) \ln \left (x -\textit {\_R} \right )}{8 \textit {\_R}^{3}+3 \textit {\_R}^{2}+10 \textit {\_R} +1}\right )\) \(67\)
risch \(\frac {x^{2}}{2}+x +\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (2 \textit {\_Z}^{4}+\textit {\_Z}^{3}+5 \textit {\_Z}^{2}+\textit {\_Z} +2\right )}{\sum }\frac {\left (-5 \textit {\_R}^{3}-\textit {\_R}^{2}-3 \textit {\_R} -2\right ) \ln \left (x -\textit {\_R} \right )}{8 \textit {\_R}^{3}+3 \textit {\_R}^{2}+10 \textit {\_R} +1}\right )\) \(67\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 315 vs. \(2 (132) = 264\).

Time = 0.10 (sec) , antiderivative size = 315, normalized size of antiderivative = 1.44 \[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=\frac {1}{2} \, x^{2} + \frac {1}{8} \, {\left (\sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} - 5\right )} \log \left (296 \, x^{2} + 7 \, {\left (7 \, \sqrt {\frac {11}{7}} {\left (12 \, x + 1\right )} - 106 \, x - 15\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + 74 \, x + 259 \, \sqrt {\frac {11}{7}} + 37\right ) - \frac {1}{8} \, {\left (\sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + 5\right )} \log \left (296 \, x^{2} - 7 \, {\left (7 \, \sqrt {\frac {11}{7}} {\left (12 \, x + 1\right )} - 106 \, x - 15\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + 74 \, x + 259 \, \sqrt {\frac {11}{7}} + 37\right ) - \frac {1}{2} \, \sqrt {\frac {9}{74} \, {\left (64 \, \sqrt {\frac {11}{7}} - 79\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + \frac {16}{7} \, \sqrt {\frac {11}{7}} + \frac {1}{14}} \arctan \left (\frac {7}{77552} \, {\left (37 \, \sqrt {\frac {11}{7}} {\left (97 \, x + 104\right )} + 7 \, {\left (\sqrt {\frac {11}{7}} {\left (1223 \, x - 936\right )} - 1331 \, x + 1197\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} - 3145 \, x - 4921\right )} \sqrt {\frac {9}{74} \, {\left (64 \, \sqrt {\frac {11}{7}} - 79\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + \frac {16}{7} \, \sqrt {\frac {11}{7}} + \frac {1}{14}}\right ) + \frac {1}{2} \, \sqrt {-\frac {9}{74} \, {\left (64 \, \sqrt {\frac {11}{7}} - 79\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + \frac {16}{7} \, \sqrt {\frac {11}{7}} + \frac {1}{14}} \arctan \left (-\frac {7}{77552} \, {\left (37 \, \sqrt {\frac {11}{7}} {\left (97 \, x + 104\right )} - 7 \, {\left (\sqrt {\frac {11}{7}} {\left (1223 \, x - 936\right )} - 1331 \, x + 1197\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} - 3145 \, x - 4921\right )} \sqrt {-\frac {9}{74} \, {\left (64 \, \sqrt {\frac {11}{7}} - 79\right )} \sqrt {\frac {64}{7} \, \sqrt {\frac {11}{7}} + \frac {79}{7}} + \frac {16}{7} \, \sqrt {\frac {11}{7}} + \frac {1}{14}}\right ) + x \] Input:

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

Output:

1/2*x^2 + 1/8*(sqrt(64/7*sqrt(11/7) + 79/7) - 5)*log(296*x^2 + 7*(7*sqrt(1 
1/7)*(12*x + 1) - 106*x - 15)*sqrt(64/7*sqrt(11/7) + 79/7) + 74*x + 259*sq 
rt(11/7) + 37) - 1/8*(sqrt(64/7*sqrt(11/7) + 79/7) + 5)*log(296*x^2 - 7*(7 
*sqrt(11/7)*(12*x + 1) - 106*x - 15)*sqrt(64/7*sqrt(11/7) + 79/7) + 74*x + 
 259*sqrt(11/7) + 37) - 1/2*sqrt(9/74*(64*sqrt(11/7) - 79)*sqrt(64/7*sqrt( 
11/7) + 79/7) + 16/7*sqrt(11/7) + 1/14)*arctan(7/77552*(37*sqrt(11/7)*(97* 
x + 104) + 7*(sqrt(11/7)*(1223*x - 936) - 1331*x + 1197)*sqrt(64/7*sqrt(11 
/7) + 79/7) - 3145*x - 4921)*sqrt(9/74*(64*sqrt(11/7) - 79)*sqrt(64/7*sqrt 
(11/7) + 79/7) + 16/7*sqrt(11/7) + 1/14)) + 1/2*sqrt(-9/74*(64*sqrt(11/7) 
- 79)*sqrt(64/7*sqrt(11/7) + 79/7) + 16/7*sqrt(11/7) + 1/14)*arctan(-7/775 
52*(37*sqrt(11/7)*(97*x + 104) - 7*(sqrt(11/7)*(1223*x - 936) - 1331*x + 1 
197)*sqrt(64/7*sqrt(11/7) + 79/7) - 3145*x - 4921)*sqrt(-9/74*(64*sqrt(11/ 
7) - 79)*sqrt(64/7*sqrt(11/7) + 79/7) + 16/7*sqrt(11/7) + 1/14)) + x
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 3662 vs. \(2 (178) = 356\).

Time = 1.61 (sec) , antiderivative size = 3662, normalized size of antiderivative = 16.72 \[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=\text {Too large to display} \] Input:

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

Output:

x**2/2 + x + (-5/8 + sqrt(79/448 + sqrt(77)/49))*log(x**2 + x*(-1459*sqrt( 
14)*sqrt(-333*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/536576 - 15 
*sqrt(77)*sqrt(553 + 64*sqrt(77))/2096 - 10391*sqrt(553 + 64*sqrt(77))/268 
288 + 1459*sqrt(77)/8384 + 522933/268288 + 45*sqrt(14)*sqrt(553 + 64*sqrt( 
77))*sqrt(-333*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/536576) - 
510895297*sqrt(14)*sqrt(-333*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(7 
7))/71978450944 - 6009493*sqrt(22)*sqrt(-333*sqrt(553 + 64*sqrt(77)) + 219 
75 + 7648*sqrt(77))/1124663296 - 38714551*sqrt(77)*sqrt(553 + 64*sqrt(77)) 
/2249326592 - 4417610843*sqrt(553 + 64*sqrt(77))/35989225472 + 153195*sqrt 
(22)*sqrt(553 + 64*sqrt(77))*sqrt(-333*sqrt(553 + 64*sqrt(77)) + 21975 + 7 
648*sqrt(77))/2249326592 + 8313499*sqrt(14)*sqrt(553 + 64*sqrt(77))*sqrt(- 
333*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/71978450944 + 2908324 
44193/35989225472 + 2303470247*sqrt(77)/2249326592) + (-5/8 - sqrt(79/448 
+ sqrt(77)/49))*log(x**2 + x*(-45*sqrt(14)*sqrt(553 + 64*sqrt(77))*sqrt(33 
3*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/536576 - 1459*sqrt(14)* 
sqrt(333*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/536576 + 10391*s 
qrt(553 + 64*sqrt(77))/268288 + 1459*sqrt(77)/8384 + 522933/268288 + 15*sq 
rt(77)*sqrt(553 + 64*sqrt(77))/2096) - 510895297*sqrt(14)*sqrt(333*sqrt(55 
3 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/71978450944 - 6009493*sqrt(22)*s 
qrt(333*sqrt(553 + 64*sqrt(77)) + 21975 + 7648*sqrt(77))/1124663296 - 8...
 

Maxima [F]

\[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=\int { \frac {{\left (2 \, x^{3} + 3 \, x^{2} + x + 5\right )} x^{2}}{2 \, x^{4} + x^{3} + 5 \, x^{2} + x + 2} \,d x } \] Input:

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

Output:

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

Giac [F]

\[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=\int { \frac {{\left (2 \, x^{3} + 3 \, x^{2} + x + 5\right )} x^{2}}{2 \, x^{4} + x^{3} + 5 \, x^{2} + x + 2} \,d x } \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 188, normalized size of antiderivative = 0.86 \[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=x+\frac {x^2}{2}+\left (\sum _{k=1}^4\ln \left (-\frac {179\,\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )}{8}-7\,x-\frac {\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )\,x\,459}{8}-\frac {{\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )}^2\,x\,665}{8}-\frac {{\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )}^3\,x\,147}{4}-\frac {35\,{\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )}^2}{32}+\frac {49\,{\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )}^3}{16}-15\right )\,\mathrm {root}\left (z^4+\frac {5\,z^3}{2}+2\,z^2+\frac {32\,z}{49}+\frac {128}{343},z,k\right )\right ) \] Input:

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

Output:

x + x^2/2 + symsum(log((49*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 128/ 
343, z, k)^3)/16 - 7*x - (459*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 1 
28/343, z, k)*x)/8 - (665*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 128/3 
43, z, k)^2*x)/8 - (147*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 128/343 
, z, k)^3*x)/4 - (35*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 128/343, z 
, k)^2)/32 - (179*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 128/343, z, k 
))/8 - 15)*root(z^4 + (5*z^3)/2 + 2*z^2 + (32*z)/49 + 128/343, z, k), k, 1 
, 4)
 

Reduce [F]

\[ \int \frac {x^2 \left (5+x+3 x^2+2 x^3\right )}{2+x+5 x^2+x^3+2 x^4} \, dx=\frac {7 \left (\int \frac {x^{2}}{2 x^{4}+x^{3}+5 x^{2}+x +2}d x \right )}{8}+\frac {13 \left (\int \frac {x}{2 x^{4}+x^{3}+5 x^{2}+x +2}d x \right )}{4}-\frac {11 \left (\int \frac {1}{2 x^{4}+x^{3}+5 x^{2}+x +2}d x \right )}{8}-\frac {5 \,\mathrm {log}\left (2 x^{4}+x^{3}+5 x^{2}+x +2\right )}{8}+\frac {x^{2}}{2}+x \] Input:

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

Output:

(7*int(x**2/(2*x**4 + x**3 + 5*x**2 + x + 2),x) + 26*int(x/(2*x**4 + x**3 
+ 5*x**2 + x + 2),x) - 11*int(1/(2*x**4 + x**3 + 5*x**2 + x + 2),x) - 5*lo 
g(2*x**4 + x**3 + 5*x**2 + x + 2) + 4*x**2 + 8*x)/8