3.6.15 \(\int \frac {x^2}{1+2 e^x+e^{2 x}} \, dx\) [515]

Optimal. Leaf size=72 \[ -x^2+\frac {x^2}{1+e^x}+\frac {x^3}{3}+2 x \log \left (1+e^x\right )-x^2 \log \left (1+e^x\right )+2 \text {Li}_2\left (-e^x\right )-2 x \text {Li}_2\left (-e^x\right )+2 \text {Li}_3\left (-e^x\right ) \]

[Out]

-x^2+x^2/(1+exp(x))+1/3*x^3+2*x*ln(1+exp(x))-x^2*ln(1+exp(x))+2*polylog(2,-exp(x))-2*x*polylog(2,-exp(x))+2*po
lylog(3,-exp(x))

________________________________________________________________________________________

Rubi [A]
time = 0.15, antiderivative size = 72, normalized size of antiderivative = 1.00, number of steps used = 12, number of rules used = 10, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.556, Rules used = {6820, 2216, 2215, 2221, 2611, 2320, 6724, 2222, 2317, 2438} \begin {gather*} -2 x \text {PolyLog}\left (2,-e^x\right )+2 \text {PolyLog}\left (2,-e^x\right )+2 \text {PolyLog}\left (3,-e^x\right )+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2-x^2 \log \left (e^x+1\right )+2 x \log \left (e^x+1\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-x^2 + x^2/(1 + E^x) + x^3/3 + 2*x*Log[1 + E^x] - x^2*Log[1 + E^x] + 2*PolyLog[2, -E^x] - 2*x*PolyLog[2, -E^x]
 + 2*PolyLog[3, -E^x]

Rule 2215

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

Rule 2216

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

Rule 2221

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

Rule 2222

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

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2320

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2611

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

Rule 6724

Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[PolyLog[n + 1, c*(a
+ b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d, e, n, p}, x] && EqQ[b*d, a*e]

Rule 6820

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

Rubi steps

\begin {align*} \int \frac {x^2}{1+2 e^x+e^{2 x}} \, dx &=\int \frac {x^2}{\left (1+e^x\right )^2} \, dx\\ &=-\int \frac {e^x x^2}{\left (1+e^x\right )^2} \, dx+\int \frac {x^2}{1+e^x} \, dx\\ &=\frac {x^2}{1+e^x}+\frac {x^3}{3}-2 \int \frac {x}{1+e^x} \, dx-\int \frac {e^x x^2}{1+e^x} \, dx\\ &=-x^2+\frac {x^2}{1+e^x}+\frac {x^3}{3}-x^2 \log \left (1+e^x\right )+2 \int \frac {e^x x}{1+e^x} \, dx+2 \int x \log \left (1+e^x\right ) \, dx\\ &=-x^2+\frac {x^2}{1+e^x}+\frac {x^3}{3}+2 x \log \left (1+e^x\right )-x^2 \log \left (1+e^x\right )-2 x \text {Li}_2\left (-e^x\right )-2 \int \log \left (1+e^x\right ) \, dx+2 \int \text {Li}_2\left (-e^x\right ) \, dx\\ &=-x^2+\frac {x^2}{1+e^x}+\frac {x^3}{3}+2 x \log \left (1+e^x\right )-x^2 \log \left (1+e^x\right )-2 x \text {Li}_2\left (-e^x\right )-2 \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^x\right )+2 \text {Subst}\left (\int \frac {\text {Li}_2(-x)}{x} \, dx,x,e^x\right )\\ &=-x^2+\frac {x^2}{1+e^x}+\frac {x^3}{3}+2 x \log \left (1+e^x\right )-x^2 \log \left (1+e^x\right )+2 \text {Li}_2\left (-e^x\right )-2 x \text {Li}_2\left (-e^x\right )+2 \text {Li}_3\left (-e^x\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.08, size = 57, normalized size = 0.79 \begin {gather*} \frac {x^2 \left (e^x (-3+x)+x\right )}{3 \left (1+e^x\right )}-(-2+x) x \log \left (1+e^x\right )-2 (-1+x) \text {Li}_2\left (-e^x\right )+2 \text {Li}_3\left (-e^x\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

(x^2*(E^x*(-3 + x) + x))/(3*(1 + E^x)) - (-2 + x)*x*Log[1 + E^x] - 2*(-1 + x)*PolyLog[2, -E^x] + 2*PolyLog[3,
-E^x]

________________________________________________________________________________________

Maple [A]
time = 0.02, size = 65, normalized size = 0.90

method result size
risch \(-x^{2}+\frac {x^{2}}{1+{\mathrm e}^{x}}+\frac {x^{3}}{3}+2 x \ln \left (1+{\mathrm e}^{x}\right )-x^{2} \ln \left (1+{\mathrm e}^{x}\right )+2 \polylog \left (2, -{\mathrm e}^{x}\right )-2 x \polylog \left (2, -{\mathrm e}^{x}\right )+2 \polylog \left (3, -{\mathrm e}^{x}\right )\) \(65\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x^2+x^2/(1+exp(x))+1/3*x^3+2*x*ln(1+exp(x))-x^2*ln(1+exp(x))+2*polylog(2,-exp(x))-2*x*polylog(2,-exp(x))+2*po
lylog(3,-exp(x))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 62, normalized size = 0.86 \begin {gather*} \frac {1}{3} \, x^{3} - x^{2} \log \left (e^{x} + 1\right ) - x^{2} - 2 \, x {\rm Li}_2\left (-e^{x}\right ) + 2 \, x \log \left (e^{x} + 1\right ) + \frac {x^{2}}{e^{x} + 1} + 2 \, {\rm Li}_2\left (-e^{x}\right ) + 2 \, {\rm Li}_{3}(-e^{x}) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/3*x^3 - x^2*log(e^x + 1) - x^2 - 2*x*dilog(-e^x) + 2*x*log(e^x + 1) + x^2/(e^x + 1) + 2*dilog(-e^x) + 2*poly
log(3, -e^x)

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 76, normalized size = 1.06 \begin {gather*} \frac {x^{3} - 6 \, {\left ({\left (x - 1\right )} e^{x} + x - 1\right )} {\rm Li}_2\left (-e^{x}\right ) + {\left (x^{3} - 3 \, x^{2}\right )} e^{x} - 3 \, {\left (x^{2} + {\left (x^{2} - 2 \, x\right )} e^{x} - 2 \, x\right )} \log \left (e^{x} + 1\right ) + 6 \, {\left (e^{x} + 1\right )} {\rm polylog}\left (3, -e^{x}\right )}{3 \, {\left (e^{x} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/3*(x^3 - 6*((x - 1)*e^x + x - 1)*dilog(-e^x) + (x^3 - 3*x^2)*e^x - 3*(x^2 + (x^2 - 2*x)*e^x - 2*x)*log(e^x +
 1) + 6*(e^x + 1)*polylog(3, -e^x))/(e^x + 1)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {x^{2}}{e^{x} + 1} + \int \frac {x \left (x - 2\right )}{e^{x} + 1}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x**2/(exp(x) + 1) + Integral(x*(x - 2)/(exp(x) + 1), x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

integrate(x^2/(e^(2*x) + 2*e^x + 1), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {x^2}{{\mathrm {e}}^{2\,x}+2\,{\mathrm {e}}^x+1} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________