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

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 = 244 \[ \int \frac {x^2}{a+b e^{-x}+c e^x} \, dx=\frac {x^2 \log \left (1+\frac {2 c e^x}{a-\sqrt {a^2-4 b c}}\right )}{\sqrt {a^2-4 b c}}-\frac {x^2 \log \left (1+\frac {2 c e^x}{a+\sqrt {a^2-4 b c}}\right )}{\sqrt {a^2-4 b c}}+\frac {2 x \operatorname {PolyLog}\left (2,-\frac {2 c e^x}{a-\sqrt {a^2-4 b c}}\right )}{\sqrt {a^2-4 b c}}-\frac {2 x \operatorname {PolyLog}\left (2,-\frac {2 c e^x}{a+\sqrt {a^2-4 b c}}\right )}{\sqrt {a^2-4 b c}}-\frac {2 \operatorname {PolyLog}\left (3,-\frac {2 c e^x}{a-\sqrt {a^2-4 b c}}\right )}{\sqrt {a^2-4 b c}}+\frac {2 \operatorname {PolyLog}\left (3,-\frac {2 c e^x}{a+\sqrt {a^2-4 b c}}\right )}{\sqrt {a^2-4 b c}} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 1.57 (sec) , antiderivative size = 223, normalized size of antiderivative = 0.91, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {2697, 2694, 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^x} \, dx\)

\(\Big \downarrow \) 2697

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

\(\Big \downarrow \) 2694

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

\(\Big \downarrow \) 2620

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

\(\Big \downarrow \) 3011

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

\(\Big \downarrow \) 2720

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

\(\Big \downarrow \) 7143

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

Input:

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

Output:

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

Defintions of rubi rules used

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 2694
Int[((F_)^(u_)*((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*(F^u/(b - q + 2*c*F^u)), x], x] - Simp[2*(c/q)   Int[(f + g*x) 
^m*(F^u/(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 2697
Int[(u_)/((a_) + (b_.)*(F_)^(v_) + (c_.)*(F_)^(w_)), x_Symbol] :> Int[u*(F^ 
v/(c + a*F^v + b*F^(2*v))), x] /; FreeQ[{F, a, b, c}, x] && EqQ[w, -v] && L 
inearQ[v, x] && If[RationalQ[D[v, x]], GtQ[D[v, x], 0], LtQ[LeafCount[v], L 
eafCount[w]]]
 

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}^{x}}d x\]

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

integrate(x^2/(a+b/exp(x)+c*exp(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(a^2-4*b*c>0)', see `assume?` for 
 more deta
 

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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