\(\int \frac {2-4 x-2 x^2+e^{2+x} (1+2 x+x^2)+e^x (30+60 x+30 x^2)}{1+2 x+x^2} \, dx\) [7486]

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

Optimal result

Integrand size = 49, antiderivative size = 32 \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=5+e^5+e^{2+x}+2 \left (5 \left (5+3 e^x\right )-x\right )-\frac {4}{1+x} \]

[Out]

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

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.66, number of steps used = 7, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.082, Rules used = {27, 6820, 2225, 697} \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=-2 x+30 e^x+e^{x+2}-\frac {4}{x+1} \]

[In]

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

[Out]

30*E^x + E^(2 + x) - 2*x - 4/(1 + 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 697

Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d +
 e*x)^m*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && EqQ[2*c*d - b*e,
 0] && IGtQ[p, 0] &&  !(EqQ[m, 3] && NeQ[p, 1])

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 6820

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

Rubi steps \begin{align*} \text {integral}& = \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{(1+x)^2} \, dx \\ & = \int \left (30 e^x+e^{2+x}-\frac {2 \left (-1+2 x+x^2\right )}{(1+x)^2}\right ) \, dx \\ & = -\left (2 \int \frac {-1+2 x+x^2}{(1+x)^2} \, dx\right )+30 \int e^x \, dx+\int e^{2+x} \, dx \\ & = 30 e^x+e^{2+x}-2 \int \left (1-\frac {2}{(1+x)^2}\right ) \, dx \\ & = 30 e^x+e^{2+x}-2 x-\frac {4}{1+x} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.66 \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=30 e^x+e^{2+x}-2 x-\frac {4}{1+x} \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.62

method result size
parts \(-2 x -\frac {4}{1+x}+30 \,{\mathrm e}^{x}+{\mathrm e}^{2+x}\) \(20\)
risch \(-2 x -\frac {4}{1+x}+{\mathrm e}^{2} {\mathrm e}^{x}+30 \,{\mathrm e}^{x}\) \(21\)
norman \(\frac {\left ({\mathrm e}^{2}+30\right ) {\mathrm e}^{x}+\left ({\mathrm e}^{2}+30\right ) x \,{\mathrm e}^{x}-2 x^{2}-2}{1+x}\) \(29\)
parallelrisch \(-\frac {2 x^{2}-30 \,{\mathrm e}^{x} x -x \,{\mathrm e}^{2+x}+2-30 \,{\mathrm e}^{x}-{\mathrm e}^{2+x}}{1+x}\) \(37\)
default \({\mathrm e}^{2} \left (-\frac {{\mathrm e}^{x}}{1+x}-{\mathrm e}^{-1} \operatorname {Ei}_{1}\left (-1-x \right )\right )+{\mathrm e}^{2} \left ({\mathrm e}^{x}-\frac {{\mathrm e}^{x}}{1+x}+{\mathrm e}^{-1} \operatorname {Ei}_{1}\left (-1-x \right )\right )-\frac {4}{1+x}-2 x +30 \,{\mathrm e}^{x}+\frac {2 \,{\mathrm e}^{2} {\mathrm e}^{x}}{1+x}\) \(76\)

[In]

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

[Out]

-2*x-4/(1+x)+30*exp(x)+exp(2+x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.16 \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=-\frac {{\left (2 \, {\left (x^{2} + x + 2\right )} e^{2} - {\left ({\left (x + 1\right )} e^{2} + 30 \, x + 30\right )} e^{\left (x + 2\right )}\right )} e^{\left (-2\right )}}{x + 1} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.47 \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=- 2 x + \left (e^{2} + 30\right ) e^{x} - \frac {4}{x + 1} \]

[In]

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

[Out]

-2*x + (exp(2) + 30)*exp(x) - 4/(x + 1)

Maxima [F]

\[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=\int { -\frac {2 \, x^{2} - {\left (x^{2} + 2 \, x + 1\right )} e^{\left (x + 2\right )} - 30 \, {\left (x^{2} + 2 \, x + 1\right )} e^{x} + 4 \, x - 2}{x^{2} + 2 \, x + 1} \,d x } \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.22 \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx=-\frac {2 \, x^{2} - x e^{\left (x + 2\right )} - 30 \, x e^{x} + 2 \, x - e^{\left (x + 2\right )} - 30 \, e^{x} + 4}{x + 1} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.56 \[ \int \frac {2-4 x-2 x^2+e^{2+x} \left (1+2 x+x^2\right )+e^x \left (30+60 x+30 x^2\right )}{1+2 x+x^2} \, dx={\mathrm {e}}^x\,\left ({\mathrm {e}}^2+30\right )-2\,x-\frac {4}{x+1} \]

[In]

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

[Out]

exp(x)*(exp(2) + 30) - 2*x - 4/(x + 1)