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

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

Optimal result

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

[Out]

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

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(50\) vs. \(2(23)=46\).

Time = 0.04 (sec) , antiderivative size = 50, normalized size of antiderivative = 2.17, number of steps used = 11, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.108, Rules used = {2207, 2225, 1607, 2227} \[ \int \left (-4+e^3+e^{2 x} (-1-2 x)+2 x-3 x^2+e^x \left (4 x+2 x^2\right )\right ) \, dx=-x^3+2 e^x x^2+x^2-\left (4-e^3\right ) x+\frac {e^{2 x}}{2}-\frac {1}{2} e^{2 x} (2 x+1) \]

[In]

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

[Out]

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

Rule 1607

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^(q - p))^n, x] /; F
reeQ[{a, b, p, q}, x] && IntegerQ[n] && PosQ[q - p]

Rule 2207

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(c + d*x)^m*
((b*F^(g*(e + f*x)))^n/(f*g*n*Log[F])), x] - Dist[d*(m/(f*g*n*Log[F])), 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] && GtQ[m, 0] && IntegerQ[2*m] &&  !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 2227

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

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

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.43 \[ \int \left (-4+e^3+e^{2 x} (-1-2 x)+2 x-3 x^2+e^x \left (4 x+2 x^2\right )\right ) \, dx=-4 x+e^3 x-e^{2 x} x+x^2+2 e^x x^2-x^3 \]

[In]

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

[Out]

-4*x + E^3*x - E^(2*x)*x + x^2 + 2*E^x*x^2 - x^3

Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.30

method result size
norman \(x^{2}+\left ({\mathrm e}^{3}-4\right ) x -x^{3}-x \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{x} x^{2}\) \(30\)
parallelrisch \(x^{2}+\left ({\mathrm e}^{3}-4\right ) x -x^{3}-x \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{x} x^{2}\) \(30\)
default \(-4 x -x \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{x} x^{2}+x^{2}-x^{3}+x \,{\mathrm e}^{3}\) \(31\)
risch \(-4 x -x \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{x} x^{2}+x^{2}-x^{3}+x \,{\mathrm e}^{3}\) \(31\)
parts \(-4 x -x \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{x} x^{2}+x^{2}-x^{3}+x \,{\mathrm e}^{3}\) \(31\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

-x^3 + 2*x^2*e^x + x^2 + x*e^3 - x*e^(2*x) - 4*x

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.17 \[ \int \left (-4+e^3+e^{2 x} (-1-2 x)+2 x-3 x^2+e^x \left (4 x+2 x^2\right )\right ) \, dx=- x^{3} + 2 x^{2} e^{x} + x^{2} - x e^{2 x} + x \left (-4 + e^{3}\right ) \]

[In]

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

[Out]

-x**3 + 2*x**2*exp(x) + x**2 - x*exp(2*x) + x*(-4 + exp(3))

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.30 \[ \int \left (-4+e^3+e^{2 x} (-1-2 x)+2 x-3 x^2+e^x \left (4 x+2 x^2\right )\right ) \, dx=-x^{3} + 2 \, x^{2} e^{x} + x^{2} + x e^{3} - x e^{\left (2 \, x\right )} - 4 \, x \]

[In]

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

[Out]

-x^3 + 2*x^2*e^x + x^2 + x*e^3 - x*e^(2*x) - 4*x

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.30 \[ \int \left (-4+e^3+e^{2 x} (-1-2 x)+2 x-3 x^2+e^x \left (4 x+2 x^2\right )\right ) \, dx=-x^{3} + 2 \, x^{2} e^{x} + x^{2} + x e^{3} - x e^{\left (2 \, x\right )} - 4 \, x \]

[In]

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

[Out]

-x^3 + 2*x^2*e^x + x^2 + x*e^3 - x*e^(2*x) - 4*x

Mupad [B] (verification not implemented)

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

[In]

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

[Out]

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