3.30.16 \(\int \frac {e^{-x} (e^x (-4-4 x-x^2)+e (-2+2 x+x^2))}{4+4 x+x^2} \, dx\) [2916]

Optimal. Leaf size=27 \[ -3-e^4-x-\frac {e^{1-x} x}{2+x}+\log (3) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.23, antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 6, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.146, Rules used = {27, 6820, 2230, 2225, 2208, 2209} \begin {gather*} -x-e^{1-x}+\frac {2 e^{1-x}}{x+2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-E^(1 - x) - x + (2*E^(1 - x))/(2 + x)

Rule 27

Int[(u_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[u*Cancel[(b/2 + c*x)^(2*p)/c^p], x] /; Fr
eeQ[{a, b, c}, x] && EqQ[b^2 - 4*a*c, 0] && IntegerQ[p]

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 2225

Int[((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.), x_Symbol] :> Simp[(F^(c*(a + b*x)))^n/(b*c*n*Log[F]), x] /; Fre
eQ[{F, a, b, c, n}, x]

Rule 2230

Int[(F_)^((c_.)*(v_))*(u_)^(m_.)*(w_), x_Symbol] :> Int[ExpandIntegrand[F^(c*ExpandToSum[v, x]), w*NormalizePo
werOfLinear[u, x]^m, x], x] /; FreeQ[{F, c}, x] && PolynomialQ[w, x] && LinearQ[v, x] && PowerOfLinearQ[u, x]
&& IntegerQ[m] &&  !TrueQ[$UseGamma]

Rule 6820

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

Rubi steps

\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {e^{-x} \left (e^x \left (-4-4 x-x^2\right )+e \left (-2+2 x+x^2\right )\right )}{(2+x)^2} \, dx\\ &=\int \left (-1+\frac {e^{1-x} \left (-2+2 x+x^2\right )}{(2+x)^2}\right ) \, dx\\ &=-x+\int \frac {e^{1-x} \left (-2+2 x+x^2\right )}{(2+x)^2} \, dx\\ &=-x+\int \left (e^{1-x}-\frac {2 e^{1-x}}{(2+x)^2}-\frac {2 e^{1-x}}{2+x}\right ) \, dx\\ &=-x-2 \int \frac {e^{1-x}}{(2+x)^2} \, dx-2 \int \frac {e^{1-x}}{2+x} \, dx+\int e^{1-x} \, dx\\ &=-e^{1-x}-x+\frac {2 e^{1-x}}{2+x}-2 e^3 \text {Ei}(-2-x)+2 \int \frac {e^{1-x}}{2+x} \, dx\\ &=-e^{1-x}-x+\frac {2 e^{1-x}}{2+x}\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.13, size = 25, normalized size = 0.93 \begin {gather*} -x-\frac {e^{1-x} \left (2 x+x^2\right )}{(2+x)^2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-x - (E^(1 - x)*(2*x + x^2))/(2 + x)^2

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.79, size = 84, normalized size = 3.11

method result size
risch \(-x -\frac {x \,{\mathrm e}^{1-x}}{2+x}\) \(19\)
norman \(\frac {\left (4 \,{\mathrm e}^{x}-x \,{\mathrm e}-{\mathrm e}^{x} x^{2}\right ) {\mathrm e}^{-x}}{2+x}\) \(28\)
default \({\mathrm e} \left (-{\mathrm e}^{-x}-\frac {4 \,{\mathrm e}^{-x}}{2+x}+8 \,{\mathrm e}^{2} \expIntegral \left (1, 2+x \right )\right )-x -2 \,{\mathrm e} \left (-\frac {{\mathrm e}^{-x}}{2+x}+{\mathrm e}^{2} \expIntegral \left (1, 2+x \right )\right )+2 \,{\mathrm e} \left (\frac {2 \,{\mathrm e}^{-x}}{2+x}-3 \,{\mathrm e}^{2} \expIntegral \left (1, 2+x \right )\right )\) \(84\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

exp(1)*(-exp(-x)-4*exp(-x)/(2+x)+8*exp(2)*Ei(1,2+x))-x-2*exp(1)*(-exp(-x)/(2+x)+exp(2)*Ei(1,2+x))+2*exp(1)*(2*
exp(-x)/(2+x)-3*exp(2)*Ei(1,2+x))

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.41, size = 26, normalized size = 0.96 \begin {gather*} -\frac {{\left (x e + {\left (x^{2} + 2 \, x\right )} e^{x}\right )} e^{\left (-x\right )}}{x + 2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(x*e + (x^2 + 2*x)*e^x)*e^(-x)/(x + 2)

________________________________________________________________________________________

Sympy [A]
time = 0.05, size = 14, normalized size = 0.52 \begin {gather*} - x - \frac {e x e^{- x}}{x + 2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x - E*x*exp(-x)/(x + 2)

________________________________________________________________________________________

Giac [A]
time = 0.40, size = 22, normalized size = 0.81 \begin {gather*} -\frac {x^{2} + x e^{\left (-x + 1\right )} + 2 \, x}{x + 2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(x^2 + x*e^(-x + 1) + 2*x)/(x + 2)

________________________________________________________________________________________

Mupad [B]
time = 0.11, size = 33, normalized size = 1.22 \begin {gather*} -\frac {2\,x}{x+2}-\frac {x^2}{x+2}-\frac {x\,{\mathrm {e}}^{1-x}}{x+2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________