3.1.60 \(\int (1+e^x)^2 x \, dx\) [60]

Optimal. Leaf size=38 \[ -2 e^x-\frac {e^{2 x}}{4}+2 e^x x+\frac {1}{2} e^{2 x} x+\frac {x^2}{2} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2214, 2207, 2225} \begin {gather*} \frac {x^2}{2}+2 e^x x+\frac {1}{2} e^{2 x} x-2 e^x-\frac {e^{2 x}}{4} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

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 2214

Int[((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.))^(p_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> In
t[ExpandIntegrand[(c + d*x)^m, (a + b*(F^(g*(e + f*x)))^n)^p, x], x] /; FreeQ[{F, a, b, c, d, e, f, g, m, n},
x] && IGtQ[p, 0]

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]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 29, normalized size = 0.76 \begin {gather*} \frac {1}{4} \left (8 e^x (-1+x)+2 x^2+e^{2 x} (-1+2 x)\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Mathics [A]
time = 1.97, size = 26, normalized size = 0.68 \begin {gather*} \frac {x^2}{2}+\frac {\left (-1+2 x\right ) E^{2 x}}{4}+2 \left (-1+x\right ) E^x \end {gather*}

Antiderivative was successfully verified.

[In]

mathics('Integrate[x*(1 + E^x)^2,x]')

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.01, size = 29, normalized size = 0.76

method result size
risch \(\frac {x^{2}}{2}+\left (-\frac {1}{4}+\frac {x}{2}\right ) {\mathrm e}^{2 x}+\left (2 x -2\right ) {\mathrm e}^{x}\) \(25\)
default \(-2 \,{\mathrm e}^{x}-\frac {{\mathrm e}^{2 x}}{4}+2 \,{\mathrm e}^{x} x +\frac {{\mathrm e}^{2 x} x}{2}+\frac {x^{2}}{2}\) \(29\)
norman \(-2 \,{\mathrm e}^{x}-\frac {{\mathrm e}^{2 x}}{4}+2 \,{\mathrm e}^{x} x +\frac {{\mathrm e}^{2 x} x}{2}+\frac {x^{2}}{2}\) \(29\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.26, size = 24, normalized size = 0.63 \begin {gather*} \frac {1}{2} \, x^{2} + \frac {1}{4} \, {\left (2 \, x - 1\right )} e^{\left (2 \, x\right )} + 2 \, {\left (x - 1\right )} e^{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.32, size = 24, normalized size = 0.63 \begin {gather*} \frac {1}{2} \, x^{2} + \frac {1}{4} \, {\left (2 \, x - 1\right )} e^{\left (2 \, x\right )} + 2 \, {\left (x - 1\right )} e^{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.05, size = 26, normalized size = 0.68 \begin {gather*} \frac {x^{2}}{2} + \frac {\left (2 x - 1\right ) e^{2 x}}{4} + \frac {\left (8 x - 8\right ) e^{x}}{4} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 28, normalized size = 0.74 \begin {gather*} \frac {1}{2} x^{2}+\left (2 x-2\right ) \mathrm {e}^{x}+\frac {1}{4} \left (2 x-1\right ) \mathrm {e}^{2 x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+exp(x))^2*x,x)

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.16, size = 28, normalized size = 0.74 \begin {gather*} \frac {x\,{\mathrm {e}}^{2\,x}}{2}-2\,{\mathrm {e}}^x-\frac {{\mathrm {e}}^{2\,x}}{4}+2\,x\,{\mathrm {e}}^x+\frac {x^2}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________