\(\int (-2+e^{1+2 x+x^2} (-2-4 x-4 x^2)) \, dx\) [6743]

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

Optimal result

Integrand size = 23, antiderivative size = 15 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=4-2 x-2 e^{(1+x)^2} x \]

[Out]

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

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.67, number of steps used = 8, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {2259, 2258, 2235, 2240, 2243} \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=-2 x+2 e^{(x+1)^2}-2 e^{(x+1)^2} (x+1) \]

[In]

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

[Out]

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

Rule 2235

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erfi[(c + d*x)*Rt[b*Log[F], 2
]]/(2*d*Rt[b*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && PosQ[b]

Rule 2240

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] :> Simp[(e + f*x)^n*(
F^(a + b*(c + d*x)^n)/(b*f*n*(c + d*x)^n*Log[F])), x] /; FreeQ[{F, a, b, c, d, e, f, n}, x] && EqQ[m, n - 1] &
& EqQ[d*e - c*f, 0]

Rule 2243

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(c + d*x)^(m
- n + 1)*(F^(a + b*(c + d*x)^n)/(b*d*n*Log[F])), x] - Dist[(m - n + 1)/(b*n*Log[F]), Int[(c + d*x)^(m - n)*F^(
a + b*(c + d*x)^n), x], x] /; FreeQ[{F, a, b, c, d}, x] && IntegerQ[2*((m + 1)/n)] && LtQ[0, (m + 1)/n, 5] &&
IntegerQ[n] && (LtQ[0, n, m + 1] || LtQ[m, n, 0])

Rule 2258

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*(u_), x_Symbol] :> Int[ExpandLinearProduct[F^(a + b*(c + d*
x)^n), u, c, d, x], x] /; FreeQ[{F, a, b, c, d, n}, x] && PolynomialQ[u, x]

Rule 2259

Int[(u_.)*(F_)^((a_.) + (b_.)*(v_)), x_Symbol] :> Int[u*F^(a + b*NormalizePowerOfLinear[v, x]), x] /; FreeQ[{F
, a, b}, x] && PolynomialQ[u, x] && PowerOfLinearQ[v, x] &&  !PowerOfLinearMatchQ[v, x]

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

Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.93 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=-2 x-2 e^{(1+x)^2} x \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.03 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.93

method result size
risch \(-2 x -2 \,{\mathrm e}^{\left (1+x \right )^{2}} x\) \(14\)
norman \(-2 x -2 \,{\mathrm e}^{x^{2}+2 x +1} x\) \(17\)
parallelrisch \(-2 x -2 \,{\mathrm e}^{x^{2}+2 x +1} x\) \(17\)
default \(-2 x +i {\mathrm e} \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x +i\right )-4 \,{\mathrm e} \left (\frac {{\mathrm e}^{x^{2}+2 x}}{2}+\frac {i \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x +i\right )}{2}\right )-4 \,{\mathrm e} \left (\frac {x \,{\mathrm e}^{x^{2}+2 x}}{2}-\frac {{\mathrm e}^{x^{2}+2 x}}{2}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x +i\right )}{4}\right )\) \(96\)
parts \(-2 x +i {\mathrm e} \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x +i\right )-4 \,{\mathrm e} \left (\frac {{\mathrm e}^{x^{2}+2 x}}{2}+\frac {i \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x +i\right )}{2}\right )-4 \,{\mathrm e} \left (\frac {x \,{\mathrm e}^{x^{2}+2 x}}{2}-\frac {{\mathrm e}^{x^{2}+2 x}}{2}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-1} \operatorname {erf}\left (i x +i\right )}{4}\right )\) \(96\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=-2 \, x e^{\left (x^{2} + 2 \, x + 1\right )} - 2 \, x \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=- 2 x e^{x^{2} + 2 x + 1} - 2 x \]

[In]

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

[Out]

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

Maxima [C] (verification not implemented)

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

Time = 0.25 (sec) , antiderivative size = 48, normalized size of antiderivative = 3.20 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=\frac {2 \, {\left (x + 1\right )}^{3} \Gamma \left (\frac {3}{2}, -{\left (x + 1\right )}^{2}\right )}{\left (-{\left (x + 1\right )}^{2}\right )^{\frac {3}{2}}} + i \, \sqrt {\pi } \operatorname {erf}\left (i \, x + i\right ) - 2 \, x + 2 \, e^{\left ({\left (x + 1\right )}^{2}\right )} \]

[In]

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

[Out]

2*(x + 1)^3*gamma(3/2, -(x + 1)^2)/(-(x + 1)^2)^(3/2) + I*sqrt(pi)*erf(I*x + I) - 2*x + 2*e^((x + 1)^2)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=-2 \, x e^{\left (x^{2} + 2 \, x + 1\right )} - 2 \, x \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 17.57 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07 \[ \int \left (-2+e^{1+2 x+x^2} \left (-2-4 x-4 x^2\right )\right ) \, dx=-2\,x\,\left ({\mathrm {e}}^{2\,x}\,{\mathrm {e}}^{x^2}\,\mathrm {e}+1\right ) \]

[In]

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

[Out]

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