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

3.6.15.1 Optimal result
3.6.15.2 Mathematica [A] (verified)
3.6.15.3 Rubi [A] (verified)
3.6.15.4 Maple [A] (verified)
3.6.15.5 Fricas [A] (verification not implemented)
3.6.15.6 Sympy [F]
3.6.15.7 Maxima [A] (verification not implemented)
3.6.15.8 Giac [F]
3.6.15.9 Mupad [F(-1)]

3.6.15.1 Optimal result

Integrand size = 18, antiderivative size = 72 \[ \int \frac {x^2}{1+2 e^x+e^{2 x}} \, 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 \operatorname {PolyLog}\left (2,-e^x\right )-2 x \operatorname {PolyLog}\left (2,-e^x\right )+2 \operatorname {PolyLog}\left (3,-e^x\right ) \]

output
-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*polylog(3,-exp(x))
 
3.6.15.2 Mathematica [A] (verified)

Time = 0.08 (sec) , antiderivative size = 57, normalized size of antiderivative = 0.79 \[ \int \frac {x^2}{1+2 e^x+e^{2 x}} \, dx=\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) \operatorname {PolyLog}\left (2,-e^x\right )+2 \operatorname {PolyLog}\left (3,-e^x\right ) \]

input
Integrate[x^2/(1 + 2*E^x + E^(2*x)),x]
 
output
(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]
 
3.6.15.3 Rubi [A] (verified)

Time = 0.83 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.08, number of steps used = 13, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.667, Rules used = {7239, 2616, 2615, 2620, 2621, 2615, 2620, 2715, 2838, 3011, 2720, 7143}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {x^2}{2 e^x+e^{2 x}+1} \, dx\)

\(\Big \downarrow \) 7239

\(\displaystyle \int \frac {x^2}{\left (e^x+1\right )^2}dx\)

\(\Big \downarrow \) 2616

\(\displaystyle \int \frac {x^2}{1+e^x}dx-\int \frac {e^x x^2}{\left (1+e^x\right )^2}dx\)

\(\Big \downarrow \) 2615

\(\displaystyle -\int \frac {e^x x^2}{\left (1+e^x\right )^2}dx-\int \frac {e^x x^2}{1+e^x}dx+\frac {x^3}{3}\)

\(\Big \downarrow \) 2620

\(\displaystyle -\int \frac {e^x x^2}{\left (1+e^x\right )^2}dx+2 \int x \log \left (1+e^x\right )dx+\frac {x^3}{3}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 2621

\(\displaystyle -2 \int \frac {x}{1+e^x}dx+2 \int x \log \left (1+e^x\right )dx+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 2615

\(\displaystyle -2 \left (\frac {x^2}{2}-\int \frac {e^x x}{1+e^x}dx\right )+2 \int x \log \left (1+e^x\right )dx+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 2620

\(\displaystyle -2 \left (\int \log \left (1+e^x\right )dx+\frac {x^2}{2}-x \log \left (e^x+1\right )\right )+2 \int x \log \left (1+e^x\right )dx+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 2715

\(\displaystyle -2 \left (\int e^{-x} \log \left (1+e^x\right )de^x+\frac {x^2}{2}-x \log \left (e^x+1\right )\right )+2 \int x \log \left (1+e^x\right )dx+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 2838

\(\displaystyle 2 \int x \log \left (1+e^x\right )dx-2 \left (-\operatorname {PolyLog}\left (2,-e^x\right )+\frac {x^2}{2}-x \log \left (e^x+1\right )\right )+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 3011

\(\displaystyle 2 \left (\int \operatorname {PolyLog}\left (2,-e^x\right )dx-x \operatorname {PolyLog}\left (2,-e^x\right )\right )-2 \left (-\operatorname {PolyLog}\left (2,-e^x\right )+\frac {x^2}{2}-x \log \left (e^x+1\right )\right )+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 2720

\(\displaystyle 2 \left (\int e^{-x} \operatorname {PolyLog}\left (2,-e^x\right )de^x-x \operatorname {PolyLog}\left (2,-e^x\right )\right )-2 \left (-\operatorname {PolyLog}\left (2,-e^x\right )+\frac {x^2}{2}-x \log \left (e^x+1\right )\right )+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

\(\Big \downarrow \) 7143

\(\displaystyle -2 \left (-\operatorname {PolyLog}\left (2,-e^x\right )+\frac {x^2}{2}-x \log \left (e^x+1\right )\right )+2 \left (\operatorname {PolyLog}\left (3,-e^x\right )-x \operatorname {PolyLog}\left (2,-e^x\right )\right )+\frac {x^3}{3}+\frac {x^2}{e^x+1}-x^2 \log \left (e^x+1\right )\)

input
Int[x^2/(1 + 2*E^x + E^(2*x)),x]
 
output
x^2/(1 + E^x) + x^3/3 - x^2*Log[1 + E^x] - 2*(x^2/2 - x*Log[1 + E^x] - Pol 
yLog[2, -E^x]) + 2*(-(x*PolyLog[2, -E^x]) + PolyLog[3, -E^x])
 

3.6.15.3.1 Defintions of rubi rules used

rule 2615
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] - Simp[ 
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 2616
Int[((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.))^(p_)*((c_.) + 
(d_.)*(x_))^(m_.), x_Symbol] :> Simp[1/a   Int[(c + d*x)^m*(a + b*(F^(g*(e 
+ f*x)))^n)^(p + 1), x], x] - Simp[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 2620
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] - Si 
mp[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 2621
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] - Simp[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 2715
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] 
:> Simp[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 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{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 2838
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 3011
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] + Simp[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 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> 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 7239
Int[u_, x_Symbol] :> With[{v = SimplifyIntegrand[u, x]}, Int[v, x] /; Simpl 
erIntegrandQ[v, u, x]]
 
3.6.15.4 Maple [A] (verified)

Time = 0.03 (sec) , antiderivative size = 65, normalized size of antiderivative = 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 \,\operatorname {Li}_{2}\left (-{\mathrm e}^{x}\right )-2 x \,\operatorname {Li}_{2}\left (-{\mathrm e}^{x}\right )+2 \,\operatorname {Li}_{3}\left (-{\mathrm e}^{x}\right )\) \(65\)

input
int(x^2/(1+2*exp(x)+exp(2*x)),x,method=_RETURNVERBOSE)
 
output
-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*polylog(3,-exp(x))
 
3.6.15.5 Fricas [A] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.06 \[ \int \frac {x^2}{1+2 e^x+e^{2 x}} \, dx=\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 )}} \]

input
integrate(x^2/(1+2*exp(x)+exp(2*x)),x, algorithm="fricas")
 
output
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)
 
3.6.15.6 Sympy [F]

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

input
integrate(x**2/(1+2*exp(x)+exp(2*x)),x)
 
output
x**2/(exp(x) + 1) + Integral(x*(x - 2)/(exp(x) + 1), x)
 
3.6.15.7 Maxima [A] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.86 \[ \int \frac {x^2}{1+2 e^x+e^{2 x}} \, dx=\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}) \]

input
integrate(x^2/(1+2*exp(x)+exp(2*x)),x, algorithm="maxima")
 
output
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*polylog(3, -e^x)
 
3.6.15.8 Giac [F]

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

input
integrate(x^2/(1+2*exp(x)+exp(2*x)),x, algorithm="giac")
 
output
integrate(x^2/(e^(2*x) + 2*e^x + 1), x)
 
3.6.15.9 Mupad [F(-1)]

Timed out. \[ \int \frac {x^2}{1+2 e^x+e^{2 x}} \, dx=\int \frac {x^2}{{\mathrm {e}}^{2\,x}+2\,{\mathrm {e}}^x+1} \,d x \]

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