\(\int \frac {e^{-2-x} (-6-12 x-2 x^2+e^{2+x} (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7))}{x^4+3 x^5+3 x^6+x^7} \, dx\) [7126]

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

Optimal result

Integrand size = 68, antiderivative size = 32 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=x+\frac {2 e^{-2-x}-x^2}{x \left (x+x^2\right )^2}-\log (5) \]

[Out]

(2/exp(2+x)-x^2)/x/(x^2+x)^2-ln(5)+x

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(81\) vs. \(2(32)=64\).

Time = 1.23 (sec) , antiderivative size = 81, normalized size of antiderivative = 2.53, number of steps used = 48, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.074, Rules used = {6873, 6874, 2208, 2209, 1634} \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=\frac {2 e^{-x-2}}{x^3}-\frac {4 e^{-x-2}}{x^2}+x-\frac {6 e^{-x-2}}{x+1}+\frac {1}{x+1}-\frac {2 e^{-x-2}}{(x+1)^2}+\frac {1}{(x+1)^2}+\frac {6 e^{-x-2}}{x}-\frac {1}{x} \]

[In]

Int[(E^(-2 - x)*(-6 - 12*x - 2*x^2 + E^(2 + x)*(x^2 + 3*x^3 + x^4 + 3*x^5 + 3*x^6 + x^7)))/(x^4 + 3*x^5 + 3*x^
6 + x^7),x]

[Out]

(2*E^(-2 - x))/x^3 - (4*E^(-2 - x))/x^2 - x^(-1) + (6*E^(-2 - x))/x + x + (1 + x)^(-2) - (2*E^(-2 - x))/(1 + x
)^2 + (1 + x)^(-1) - (6*E^(-2 - x))/(1 + x)

Rule 1634

Int[(Px_)*((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[Px*(a + b*x)
^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && PolyQ[Px, x] && (IntegersQ[m, n] || IGtQ[m, -2]) &&
GtQ[Expon[Px, x], 2]

Rule 2208

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_), x_Symbol] :> Simp[(c + d*x)^(m
+ 1)*((b*F^(g*(e + f*x)))^n/(d*(m + 1))), x] - Dist[f*g*n*(Log[F]/(d*(m + 1))), Int[(c + d*x)^(m + 1)*(b*F^(g*
(e + f*x)))^n, x], x] /; FreeQ[{F, b, c, d, e, f, g, n}, x] && LtQ[m, -1] && IntegerQ[2*m] &&  !TrueQ[$UseGamm
a]

Rule 2209

Int[(F_)^((g_.)*((e_.) + (f_.)*(x_)))/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[(F^(g*(e - c*(f/d)))/d)*ExpInteg
ralEi[f*g*(c + d*x)*(Log[F]/d)], x] /; FreeQ[{F, c, d, e, f, g}, x] &&  !TrueQ[$UseGamma]

Rule 6873

Int[u_, x_Symbol] :> With[{v = NormalizeIntegrand[u, x]}, Int[v, x] /; v =!= u]

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps \begin{align*} \text {integral}& = \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4 (1+x)^3} \, dx \\ & = \int \left (-\frac {6 e^{-2-x}}{x^4 (1+x)^3}-\frac {12 e^{-2-x}}{x^3 (1+x)^3}-\frac {2 e^{-2-x}}{x^2 (1+x)^3}+\frac {1+3 x+x^2+3 x^3+3 x^4+x^5}{x^2 (1+x)^3}\right ) \, dx \\ & = -\left (2 \int \frac {e^{-2-x}}{x^2 (1+x)^3} \, dx\right )-6 \int \frac {e^{-2-x}}{x^4 (1+x)^3} \, dx-12 \int \frac {e^{-2-x}}{x^3 (1+x)^3} \, dx+\int \frac {1+3 x+x^2+3 x^3+3 x^4+x^5}{x^2 (1+x)^3} \, dx \\ & = -\left (2 \int \left (\frac {e^{-2-x}}{x^2}-\frac {3 e^{-2-x}}{x}+\frac {e^{-2-x}}{(1+x)^3}+\frac {2 e^{-2-x}}{(1+x)^2}+\frac {3 e^{-2-x}}{1+x}\right ) \, dx\right )-6 \int \left (\frac {e^{-2-x}}{x^4}-\frac {3 e^{-2-x}}{x^3}+\frac {6 e^{-2-x}}{x^2}-\frac {10 e^{-2-x}}{x}+\frac {e^{-2-x}}{(1+x)^3}+\frac {4 e^{-2-x}}{(1+x)^2}+\frac {10 e^{-2-x}}{1+x}\right ) \, dx-12 \int \left (\frac {e^{-2-x}}{x^3}-\frac {3 e^{-2-x}}{x^2}+\frac {6 e^{-2-x}}{x}-\frac {e^{-2-x}}{(1+x)^3}-\frac {3 e^{-2-x}}{(1+x)^2}-\frac {6 e^{-2-x}}{1+x}\right ) \, dx+\int \left (1+\frac {1}{x^2}-\frac {2}{(1+x)^3}-\frac {1}{(1+x)^2}\right ) \, dx \\ & = -\frac {1}{x}+x+\frac {1}{(1+x)^2}+\frac {1}{1+x}-2 \int \frac {e^{-2-x}}{x^2} \, dx-2 \int \frac {e^{-2-x}}{(1+x)^3} \, dx-4 \int \frac {e^{-2-x}}{(1+x)^2} \, dx-6 \int \frac {e^{-2-x}}{x^4} \, dx+6 \int \frac {e^{-2-x}}{x} \, dx-6 \int \frac {e^{-2-x}}{(1+x)^3} \, dx-6 \int \frac {e^{-2-x}}{1+x} \, dx-12 \int \frac {e^{-2-x}}{x^3} \, dx+12 \int \frac {e^{-2-x}}{(1+x)^3} \, dx+18 \int \frac {e^{-2-x}}{x^3} \, dx-24 \int \frac {e^{-2-x}}{(1+x)^2} \, dx+36 \int \frac {e^{-2-x}}{(1+x)^2} \, dx+60 \int \frac {e^{-2-x}}{x} \, dx-60 \int \frac {e^{-2-x}}{1+x} \, dx-72 \int \frac {e^{-2-x}}{x} \, dx+72 \int \frac {e^{-2-x}}{1+x} \, dx \\ & = \frac {2 e^{-2-x}}{x^3}-\frac {3 e^{-2-x}}{x^2}-\frac {1}{x}+\frac {2 e^{-2-x}}{x}+x+\frac {1}{(1+x)^2}-\frac {2 e^{-2-x}}{(1+x)^2}+\frac {1}{1+x}-\frac {8 e^{-2-x}}{1+x}+\frac {6 \operatorname {ExpIntegralEi}(-1-x)}{e}-\frac {6 \operatorname {ExpIntegralEi}(-x)}{e^2}+2 \int \frac {e^{-2-x}}{x^3} \, dx+2 \int \frac {e^{-2-x}}{x} \, dx+3 \int \frac {e^{-2-x}}{(1+x)^2} \, dx+4 \int \frac {e^{-2-x}}{1+x} \, dx+6 \int \frac {e^{-2-x}}{x^2} \, dx-6 \int \frac {e^{-2-x}}{(1+x)^2} \, dx-9 \int \frac {e^{-2-x}}{x^2} \, dx+24 \int \frac {e^{-2-x}}{1+x} \, dx-36 \int \frac {e^{-2-x}}{1+x} \, dx+\int \frac {e^{-2-x}}{(1+x)^2} \, dx \\ & = \frac {2 e^{-2-x}}{x^3}-\frac {4 e^{-2-x}}{x^2}-\frac {1}{x}+\frac {5 e^{-2-x}}{x}+x+\frac {1}{(1+x)^2}-\frac {2 e^{-2-x}}{(1+x)^2}+\frac {1}{1+x}-\frac {6 e^{-2-x}}{1+x}-\frac {2 \operatorname {ExpIntegralEi}(-1-x)}{e}-\frac {4 \operatorname {ExpIntegralEi}(-x)}{e^2}-3 \int \frac {e^{-2-x}}{1+x} \, dx-6 \int \frac {e^{-2-x}}{x} \, dx+6 \int \frac {e^{-2-x}}{1+x} \, dx+9 \int \frac {e^{-2-x}}{x} \, dx-\int \frac {e^{-2-x}}{x^2} \, dx-\int \frac {e^{-2-x}}{1+x} \, dx \\ & = \frac {2 e^{-2-x}}{x^3}-\frac {4 e^{-2-x}}{x^2}-\frac {1}{x}+\frac {6 e^{-2-x}}{x}+x+\frac {1}{(1+x)^2}-\frac {2 e^{-2-x}}{(1+x)^2}+\frac {1}{1+x}-\frac {6 e^{-2-x}}{1+x}-\frac {\operatorname {ExpIntegralEi}(-x)}{e^2}+\int \frac {e^{-2-x}}{x} \, dx \\ & = \frac {2 e^{-2-x}}{x^3}-\frac {4 e^{-2-x}}{x^2}-\frac {1}{x}+\frac {6 e^{-2-x}}{x}+x+\frac {1}{(1+x)^2}-\frac {2 e^{-2-x}}{(1+x)^2}+\frac {1}{1+x}-\frac {6 e^{-2-x}}{1+x} \\ \end{align*}

Mathematica [A] (verified)

Time = 7.91 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.09 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=\frac {2 e^{-2-x}-x^2+x^4+2 x^5+x^6}{x^3 (1+x)^2} \]

[In]

Integrate[(E^(-2 - x)*(-6 - 12*x - 2*x^2 + E^(2 + x)*(x^2 + 3*x^3 + x^4 + 3*x^5 + 3*x^6 + x^7)))/(x^4 + 3*x^5
+ 3*x^6 + x^7),x]

[Out]

(2*E^(-2 - x) - x^2 + x^4 + 2*x^5 + x^6)/(x^3*(1 + x)^2)

Maple [A] (verified)

Time = 0.40 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.06

method result size
risch \(x -\frac {1}{x \left (x^{2}+2 x +1\right )}+\frac {2 \,{\mathrm e}^{-2-x}}{x^{3} \left (1+x \right )^{2}}\) \(34\)
norman \(\frac {\left (2+{\mathrm e}^{2+x} x^{6}-3 \,{\mathrm e}^{2+x} x^{4}-2 \,{\mathrm e}^{2+x} x^{3}-x^{2} {\mathrm e}^{2+x}\right ) {\mathrm e}^{-2-x}}{x^{3} \left (1+x \right )^{2}}\) \(53\)
parallelrisch \(\frac {\left (2+{\mathrm e}^{2+x} x^{6}-3 \,{\mathrm e}^{2+x} x^{4}-2 \,{\mathrm e}^{2+x} x^{3}-x^{2} {\mathrm e}^{2+x}\right ) {\mathrm e}^{-2-x}}{x^{3} \left (x^{2}+2 x +1\right )}\) \(58\)
parts \(x +\frac {1}{\left (1+x \right )^{2}}+\frac {1}{1+x}-\frac {1}{x}+\frac {{\mathrm e}^{-2-x} \left (139 \left (2+x \right )^{4}-892 \left (2+x \right )^{3}+2074 \left (2+x \right )^{2}-3376-2052 x \right )}{3 \left (\left (2+x \right )^{2}-2 x -3\right ) x^{3}}-\frac {5 \,{\mathrm e}^{-2-x} \left (67 \left (2+x \right )^{4}-430 \left (2+x \right )^{3}+1000 \left (2+x \right )^{2}-1630-990 x \right )}{3 \left (\left (2+x \right )^{2}-2 x -3\right ) x^{3}}+\frac {2 \,{\mathrm e}^{-2-x} \left (98 \left (2+x \right )^{4}-629 \left (2+x \right )^{3}+1463 \left (2+x \right )^{2}-2384-1449 x \right )}{3 \left (\left (2+x \right )^{2}-2 x -3\right ) x^{3}}\) \(165\)
derivativedivides \(2+x +\frac {1}{\left (1+x \right )^{2}}+\frac {1}{1+x}-\frac {1}{x}-\frac {5 \,{\mathrm e}^{-2-x} \left (67 \left (2+x \right )^{4}-430 \left (2+x \right )^{3}+1000 \left (2+x \right )^{2}-1630-990 x \right )}{3 \left (\left (2+x \right )^{5}-8 \left (2+x \right )^{4}+25 \left (2+x \right )^{3}-38 \left (2+x \right )^{2}+48+28 x \right )}+\frac {2 \,{\mathrm e}^{-2-x} \left (98 \left (2+x \right )^{4}-629 \left (2+x \right )^{3}+1463 \left (2+x \right )^{2}-2384-1449 x \right )}{3 \left (\left (2+x \right )^{5}-8 \left (2+x \right )^{4}+25 \left (2+x \right )^{3}-38 \left (2+x \right )^{2}+48+28 x \right )}+\frac {{\mathrm e}^{-2-x} \left (139 \left (2+x \right )^{4}-892 \left (2+x \right )^{3}+2074 \left (2+x \right )^{2}-3376-2052 x \right )}{3 \left (2+x \right )^{5}-24 \left (2+x \right )^{4}+75 \left (2+x \right )^{3}-114 \left (2+x \right )^{2}+144+84 x}\) \(220\)
default \(2+x +\frac {1}{\left (1+x \right )^{2}}+\frac {1}{1+x}-\frac {1}{x}-\frac {5 \,{\mathrm e}^{-2-x} \left (67 \left (2+x \right )^{4}-430 \left (2+x \right )^{3}+1000 \left (2+x \right )^{2}-1630-990 x \right )}{3 \left (\left (2+x \right )^{5}-8 \left (2+x \right )^{4}+25 \left (2+x \right )^{3}-38 \left (2+x \right )^{2}+48+28 x \right )}+\frac {2 \,{\mathrm e}^{-2-x} \left (98 \left (2+x \right )^{4}-629 \left (2+x \right )^{3}+1463 \left (2+x \right )^{2}-2384-1449 x \right )}{3 \left (\left (2+x \right )^{5}-8 \left (2+x \right )^{4}+25 \left (2+x \right )^{3}-38 \left (2+x \right )^{2}+48+28 x \right )}+\frac {{\mathrm e}^{-2-x} \left (139 \left (2+x \right )^{4}-892 \left (2+x \right )^{3}+2074 \left (2+x \right )^{2}-3376-2052 x \right )}{3 \left (2+x \right )^{5}-24 \left (2+x \right )^{4}+75 \left (2+x \right )^{3}-114 \left (2+x \right )^{2}+144+84 x}\) \(220\)

[In]

int(((x^7+3*x^6+3*x^5+x^4+3*x^3+x^2)*exp(2+x)-2*x^2-12*x-6)/(x^7+3*x^6+3*x^5+x^4)/exp(2+x),x,method=_RETURNVER
BOSE)

[Out]

x-1/x/(x^2+2*x+1)+2/x^3/(1+x)^2*exp(-2-x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.41 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=\frac {{\left ({\left (x^{6} + 2 \, x^{5} + x^{4} - x^{2}\right )} e^{\left (x + 2\right )} + 2\right )} e^{\left (-x - 2\right )}}{x^{5} + 2 \, x^{4} + x^{3}} \]

[In]

integrate(((x^7+3*x^6+3*x^5+x^4+3*x^3+x^2)*exp(2+x)-2*x^2-12*x-6)/(x^7+3*x^6+3*x^5+x^4)/exp(2+x),x, algorithm=
"fricas")

[Out]

((x^6 + 2*x^5 + x^4 - x^2)*e^(x + 2) + 2)*e^(-x - 2)/(x^5 + 2*x^4 + x^3)

Sympy [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.00 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=x + \frac {2 e^{- x - 2}}{x^{5} + 2 x^{4} + x^{3}} - \frac {1}{x^{3} + 2 x^{2} + x} \]

[In]

integrate(((x**7+3*x**6+3*x**5+x**4+3*x**3+x**2)*exp(2+x)-2*x**2-12*x-6)/(x**7+3*x**6+3*x**5+x**4)/exp(2+x),x)

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 134 vs. \(2 (30) = 60\).

Time = 0.25 (sec) , antiderivative size = 134, normalized size of antiderivative = 4.19 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=x - \frac {6 \, x^{2} + 9 \, x + 2}{2 \, {\left (x^{3} + 2 \, x^{2} + x\right )}} - \frac {6 \, x + 5}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} + \frac {3 \, {\left (4 \, x + 3\right )}}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} + \frac {3 \, {\left (2 \, x + 3\right )}}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} - \frac {3 \, {\left (2 \, x + 1\right )}}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} + \frac {2 \, e^{\left (-x\right )}}{x^{5} e^{2} + 2 \, x^{4} e^{2} + x^{3} e^{2}} - \frac {1}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} \]

[In]

integrate(((x^7+3*x^6+3*x^5+x^4+3*x^3+x^2)*exp(2+x)-2*x^2-12*x-6)/(x^7+3*x^6+3*x^5+x^4)/exp(2+x),x, algorithm=
"maxima")

[Out]

x - 1/2*(6*x^2 + 9*x + 2)/(x^3 + 2*x^2 + x) - 1/2*(6*x + 5)/(x^2 + 2*x + 1) + 3/2*(4*x + 3)/(x^2 + 2*x + 1) +
3/2*(2*x + 3)/(x^2 + 2*x + 1) - 3/2*(2*x + 1)/(x^2 + 2*x + 1) + 2*e^(-x)/(x^5*e^2 + 2*x^4*e^2 + x^3*e^2) - 1/2
/(x^2 + 2*x + 1)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.75 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=\frac {x^{6} e^{2} + 2 \, x^{5} e^{2} + x^{4} e^{2} - x^{2} e^{2} + 2 \, e^{\left (-x\right )}}{x^{5} e^{2} + 2 \, x^{4} e^{2} + x^{3} e^{2}} \]

[In]

integrate(((x^7+3*x^6+3*x^5+x^4+3*x^3+x^2)*exp(2+x)-2*x^2-12*x-6)/(x^7+3*x^6+3*x^5+x^4)/exp(2+x),x, algorithm=
"giac")

[Out]

(x^6*e^2 + 2*x^5*e^2 + x^4*e^2 - x^2*e^2 + 2*e^(-x))/(x^5*e^2 + 2*x^4*e^2 + x^3*e^2)

Mupad [B] (verification not implemented)

Time = 12.89 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.78 \[ \int \frac {e^{-2-x} \left (-6-12 x-2 x^2+e^{2+x} \left (x^2+3 x^3+x^4+3 x^5+3 x^6+x^7\right )\right )}{x^4+3 x^5+3 x^6+x^7} \, dx=x+\frac {2\,{\mathrm {e}}^{-x-2}-x^2}{x^3\,{\left (x+1\right )}^2} \]

[In]

int(-(exp(- x - 2)*(12*x - exp(x + 2)*(x^2 + 3*x^3 + x^4 + 3*x^5 + 3*x^6 + x^7) + 2*x^2 + 6))/(x^4 + 3*x^5 + 3
*x^6 + x^7),x)

[Out]

x + (2*exp(- x - 2) - x^2)/(x^3*(x + 1)^2)