\(\int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx\) [442]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [F]
Fricas [A] (verification not implemented)
Sympy [F]
Maxima [F(-2)]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 20, antiderivative size = 391 \[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=-\frac {2 c x^3}{3 \left (b^2-4 a c-b \sqrt {b^2-4 a c}\right )}-\frac {2 c x^3}{3 \left (b^2-4 a c+b \sqrt {b^2-4 a c}\right )}+\frac {2 c x^2 \log \left (1+\frac {2 c e^x}{b-\sqrt {b^2-4 a c}}\right )}{b^2-4 a c-b \sqrt {b^2-4 a c}}+\frac {2 c x^2 \log \left (1+\frac {2 c e^x}{b+\sqrt {b^2-4 a c}}\right )}{b^2-4 a c+b \sqrt {b^2-4 a c}}+\frac {4 c x \operatorname {PolyLog}\left (2,-\frac {2 c e^x}{b-\sqrt {b^2-4 a c}}\right )}{b^2-4 a c-b \sqrt {b^2-4 a c}}+\frac {4 c x \operatorname {PolyLog}\left (2,-\frac {2 c e^x}{b+\sqrt {b^2-4 a c}}\right )}{b^2-4 a c+b \sqrt {b^2-4 a c}}-\frac {4 c \operatorname {PolyLog}\left (3,-\frac {2 c e^x}{b-\sqrt {b^2-4 a c}}\right )}{b^2-4 a c-b \sqrt {b^2-4 a c}}-\frac {4 c \operatorname {PolyLog}\left (3,-\frac {2 c e^x}{b+\sqrt {b^2-4 a c}}\right )}{b^2-4 a c+b \sqrt {b^2-4 a c}} \] Output:

-2*c*x^3/(3*b^2-12*a*c-3*b*(-4*a*c+b^2)^(1/2))-2*c*x^3/(3*b^2-12*a*c+3*b*( 
-4*a*c+b^2)^(1/2))+2*c*x^2*ln(1+2*c*exp(x)/(b-(-4*a*c+b^2)^(1/2)))/(b^2-4* 
a*c-b*(-4*a*c+b^2)^(1/2))+2*c*x^2*ln(1+2*c*exp(x)/(b+(-4*a*c+b^2)^(1/2)))/ 
(b*(-4*a*c+b^2)^(1/2)-4*a*c+b^2)+4*c*x*polylog(2,-2*c*exp(x)/(b-(-4*a*c+b^ 
2)^(1/2)))/(b^2-4*a*c-b*(-4*a*c+b^2)^(1/2))+4*c*x*polylog(2,-2*c*exp(x)/(b 
+(-4*a*c+b^2)^(1/2)))/(b*(-4*a*c+b^2)^(1/2)-4*a*c+b^2)-4*c*polylog(3,-2*c* 
exp(x)/(b-(-4*a*c+b^2)^(1/2)))/(b^2-4*a*c-b*(-4*a*c+b^2)^(1/2))-4*c*polylo 
g(3,-2*c*exp(x)/(b+(-4*a*c+b^2)^(1/2)))/(b*(-4*a*c+b^2)^(1/2)-4*a*c+b^2)
 

Mathematica [A] (verified)

Time = 0.37 (sec) , antiderivative size = 278, normalized size of antiderivative = 0.71 \[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\frac {2 c \left (\frac {x^2 \log \left (1+\frac {\left (b-\sqrt {b^2-4 a c}\right ) e^{-x}}{2 c}\right )}{-b+\sqrt {b^2-4 a c}}+\frac {x^2 \log \left (1+\frac {\left (b+\sqrt {b^2-4 a c}\right ) e^{-x}}{2 c}\right )}{b+\sqrt {b^2-4 a c}}+\frac {2 \left (x \operatorname {PolyLog}\left (2,\frac {\left (-b+\sqrt {b^2-4 a c}\right ) e^{-x}}{2 c}\right )+\operatorname {PolyLog}\left (3,\frac {\left (-b+\sqrt {b^2-4 a c}\right ) e^{-x}}{2 c}\right )\right )}{b-\sqrt {b^2-4 a c}}-\frac {2 \left (x \operatorname {PolyLog}\left (2,-\frac {\left (b+\sqrt {b^2-4 a c}\right ) e^{-x}}{2 c}\right )+\operatorname {PolyLog}\left (3,-\frac {\left (b+\sqrt {b^2-4 a c}\right ) e^{-x}}{2 c}\right )\right )}{b+\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}} \] Input:

Integrate[x^2/(a + b*E^x + c*E^(2*x)),x]
 

Output:

(2*c*((x^2*Log[1 + (b - Sqrt[b^2 - 4*a*c])/(2*c*E^x)])/(-b + Sqrt[b^2 - 4* 
a*c]) + (x^2*Log[1 + (b + Sqrt[b^2 - 4*a*c])/(2*c*E^x)])/(b + Sqrt[b^2 - 4 
*a*c]) + (2*(x*PolyLog[2, (-b + Sqrt[b^2 - 4*a*c])/(2*c*E^x)] + PolyLog[3, 
 (-b + Sqrt[b^2 - 4*a*c])/(2*c*E^x)]))/(b - Sqrt[b^2 - 4*a*c]) - (2*(x*Pol 
yLog[2, -1/2*(b + Sqrt[b^2 - 4*a*c])/(c*E^x)] + PolyLog[3, -1/2*(b + Sqrt[ 
b^2 - 4*a*c])/(c*E^x)]))/(b + Sqrt[b^2 - 4*a*c])))/Sqrt[b^2 - 4*a*c]
 

Rubi [A] (verified)

Time = 1.96 (sec) , antiderivative size = 313, normalized size of antiderivative = 0.80, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {2693, 2615, 2620, 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}{a+b e^x+c e^{2 x}} \, dx\)

\(\Big \downarrow \) 2693

\(\displaystyle \frac {2 c \int \frac {x^2}{b+2 c e^x-\sqrt {b^2-4 a c}}dx}{\sqrt {b^2-4 a c}}-\frac {2 c \int \frac {x^2}{b+2 c e^x+\sqrt {b^2-4 a c}}dx}{\sqrt {b^2-4 a c}}\)

\(\Big \downarrow \) 2615

\(\displaystyle \frac {2 c \left (\frac {x^3}{3 \left (b-\sqrt {b^2-4 a c}\right )}-\frac {2 c \int \frac {e^x x^2}{b+2 c e^x-\sqrt {b^2-4 a c}}dx}{b-\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}}-\frac {2 c \left (\frac {x^3}{3 \left (\sqrt {b^2-4 a c}+b\right )}-\frac {2 c \int \frac {e^x x^2}{b+2 c e^x+\sqrt {b^2-4 a c}}dx}{\sqrt {b^2-4 a c}+b}\right )}{\sqrt {b^2-4 a c}}\)

\(\Big \downarrow \) 2620

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

\(\Big \downarrow \) 3011

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

\(\Big \downarrow \) 2720

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

\(\Big \downarrow \) 7143

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

Input:

Int[x^2/(a + b*E^x + c*E^(2*x)),x]
 

Output:

(2*c*(x^3/(3*(b - Sqrt[b^2 - 4*a*c])) - (2*c*((x^2*Log[1 + (2*c*E^x)/(b - 
Sqrt[b^2 - 4*a*c])])/(2*c) - (-(x*PolyLog[2, (-2*c*E^x)/(b - Sqrt[b^2 - 4* 
a*c])]) + PolyLog[3, (-2*c*E^x)/(b - Sqrt[b^2 - 4*a*c])])/c))/(b - Sqrt[b^ 
2 - 4*a*c])))/Sqrt[b^2 - 4*a*c] - (2*c*(x^3/(3*(b + Sqrt[b^2 - 4*a*c])) - 
(2*c*((x^2*Log[1 + (2*c*E^x)/(b + Sqrt[b^2 - 4*a*c])])/(2*c) - (-(x*PolyLo 
g[2, (-2*c*E^x)/(b + Sqrt[b^2 - 4*a*c])]) + PolyLog[3, (-2*c*E^x)/(b + Sqr 
t[b^2 - 4*a*c])])/c))/(b + Sqrt[b^2 - 4*a*c])))/Sqrt[b^2 - 4*a*c]
 

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 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 2693
Int[((f_.) + (g_.)*(x_))^(m_.)/((a_.) + (b_.)*(F_)^(u_) + (c_.)*(F_)^(v_)), 
 x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Simp[2*(c/q)   Int[(f + g*x)^m 
/(b - q + 2*c*F^u), x], x] - Simp[2*(c/q)   Int[(f + g*x)^m/(b + q + 2*c*F^ 
u), x], x]] /; FreeQ[{F, a, b, c, f, g}, x] && EqQ[v, 2*u] && LinearQ[u, x] 
 && NeQ[b^2 - 4*a*c, 0] && IGtQ[m, 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 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]
 
Maple [F]

\[\int \frac {x^{2}}{a +b \,{\mathrm e}^{x}+c \,{\mathrm e}^{2 x}}d x\]

Input:

int(x^2/(a+b*exp(x)+c*exp(2*x)),x)
 

Output:

int(x^2/(a+b*exp(x)+c*exp(2*x)),x)
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 415, normalized size of antiderivative = 1.06 \[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\frac {2 \, {\left (b^{2} - 4 \, a c\right )} x^{3} - 6 \, {\left (a b x \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} + {\left (b^{2} - 4 \, a c\right )} x\right )} {\rm Li}_2\left (-\frac {a \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} e^{x} + b e^{x} + 2 \, a}{2 \, a} + 1\right ) + 6 \, {\left (a b x \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} - {\left (b^{2} - 4 \, a c\right )} x\right )} {\rm Li}_2\left (\frac {a \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} e^{x} - b e^{x} - 2 \, a}{2 \, a} + 1\right ) - 3 \, {\left (a b x^{2} \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} + {\left (b^{2} - 4 \, a c\right )} x^{2}\right )} \log \left (\frac {a \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} e^{x} + b e^{x} + 2 \, a}{2 \, a}\right ) + 3 \, {\left (a b x^{2} \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} - {\left (b^{2} - 4 \, a c\right )} x^{2}\right )} \log \left (-\frac {a \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} e^{x} - b e^{x} - 2 \, a}{2 \, a}\right ) + 6 \, {\left (a b \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} + b^{2} - 4 \, a c\right )} {\rm polylog}\left (3, -\frac {a \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} e^{x} + b e^{x}}{2 \, a}\right ) - 6 \, {\left (a b \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} - b^{2} + 4 \, a c\right )} {\rm polylog}\left (3, \frac {a \sqrt {\frac {b^{2} - 4 \, a c}{a^{2}}} e^{x} - b e^{x}}{2 \, a}\right )}{6 \, {\left (a b^{2} - 4 \, a^{2} c\right )}} \] Input:

integrate(x^2/(a+b*exp(x)+c*exp(2*x)),x, algorithm="fricas")
 

Output:

1/6*(2*(b^2 - 4*a*c)*x^3 - 6*(a*b*x*sqrt((b^2 - 4*a*c)/a^2) + (b^2 - 4*a*c 
)*x)*dilog(-1/2*(a*sqrt((b^2 - 4*a*c)/a^2)*e^x + b*e^x + 2*a)/a + 1) + 6*( 
a*b*x*sqrt((b^2 - 4*a*c)/a^2) - (b^2 - 4*a*c)*x)*dilog(1/2*(a*sqrt((b^2 - 
4*a*c)/a^2)*e^x - b*e^x - 2*a)/a + 1) - 3*(a*b*x^2*sqrt((b^2 - 4*a*c)/a^2) 
 + (b^2 - 4*a*c)*x^2)*log(1/2*(a*sqrt((b^2 - 4*a*c)/a^2)*e^x + b*e^x + 2*a 
)/a) + 3*(a*b*x^2*sqrt((b^2 - 4*a*c)/a^2) - (b^2 - 4*a*c)*x^2)*log(-1/2*(a 
*sqrt((b^2 - 4*a*c)/a^2)*e^x - b*e^x - 2*a)/a) + 6*(a*b*sqrt((b^2 - 4*a*c) 
/a^2) + b^2 - 4*a*c)*polylog(3, -1/2*(a*sqrt((b^2 - 4*a*c)/a^2)*e^x + b*e^ 
x)/a) - 6*(a*b*sqrt((b^2 - 4*a*c)/a^2) - b^2 + 4*a*c)*polylog(3, 1/2*(a*sq 
rt((b^2 - 4*a*c)/a^2)*e^x - b*e^x)/a))/(a*b^2 - 4*a^2*c)
 

Sympy [F]

\[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\int \frac {x^{2}}{a + b e^{x} + c e^{2 x}}\, dx \] Input:

integrate(x**2/(a+b*exp(x)+c*exp(2*x)),x)
 

Output:

Integral(x**2/(a + b*exp(x) + c*exp(2*x)), x)
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\text {Exception raised: ValueError} \] Input:

integrate(x^2/(a+b*exp(x)+c*exp(2*x)),x, algorithm="maxima")
 

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` for 
 more deta
 

Giac [F]

\[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\int { \frac {x^{2}}{c e^{\left (2 \, x\right )} + b e^{x} + a} \,d x } \] Input:

integrate(x^2/(a+b*exp(x)+c*exp(2*x)),x, algorithm="giac")
 

Output:

integrate(x^2/(c*e^(2*x) + b*e^x + a), x)
 

Mupad [F(-1)]

Timed out. \[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\int \frac {x^2}{a+b\,{\mathrm {e}}^x+c\,{\mathrm {e}}^{2\,x}} \,d x \] Input:

int(x^2/(a + b*exp(x) + c*exp(2*x)),x)
 

Output:

int(x^2/(a + b*exp(x) + c*exp(2*x)), x)
 

Reduce [F]

\[ \int \frac {x^2}{a+b e^x+c e^{2 x}} \, dx=\int \frac {x^{2}}{e^{2 x} c +e^{x} b +a}d x \] Input:

int(x^2/(a+b*exp(x)+c*exp(2*x)),x)
                                                                                    
                                                                                    
 

Output:

int(x**2/(e**(2*x)*c + e**x*b + a),x)