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

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

Optimal result

Integrand size = 16, antiderivative size = 67 \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=\frac {x}{a}+\frac {b \text {arctanh}\left (\frac {b+2 c e^x}{\sqrt {b^2-4 a c}}\right )}{a \sqrt {b^2-4 a c}}-\frac {\log \left (a+b e^x+c e^{2 x}\right )}{2 a} \]

[Out]

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

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.438, Rules used = {2320, 719, 29, 648, 632, 212, 642} \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=\frac {b \text {arctanh}\left (\frac {b+2 c e^x}{\sqrt {b^2-4 a c}}\right )}{a \sqrt {b^2-4 a c}}-\frac {\log \left (a+b e^x+c e^{2 x}\right )}{2 a}+\frac {x}{a} \]

[In]

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

[Out]

x/a + (b*ArcTanh[(b + 2*c*E^x)/Sqrt[b^2 - 4*a*c]])/(a*Sqrt[b^2 - 4*a*c]) - Log[a + b*E^x + c*E^(2*x)]/(2*a)

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 719

Int[1/(((d_.) + (e_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)), x_Symbol] :> Dist[e^2/(c*d^2 - b*d*e + a*e^2
), Int[1/(d + e*x), x], x] + Dist[1/(c*d^2 - b*d*e + a*e^2), Int[(c*d - b*e - c*e*x)/(a + b*x + c*x^2), x], x]
 /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && NeQ[2*c*d - b*e, 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]]]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{x \left (a+b x+c x^2\right )} \, dx,x,e^x\right ) \\ & = \frac {\text {Subst}\left (\int \frac {1}{x} \, dx,x,e^x\right )}{a}+\frac {\text {Subst}\left (\int \frac {-b-c x}{a+b x+c x^2} \, dx,x,e^x\right )}{a} \\ & = \frac {x}{a}-\frac {\text {Subst}\left (\int \frac {b+2 c x}{a+b x+c x^2} \, dx,x,e^x\right )}{2 a}-\frac {b \text {Subst}\left (\int \frac {1}{a+b x+c x^2} \, dx,x,e^x\right )}{2 a} \\ & = \frac {x}{a}-\frac {\log \left (a+b e^x+c e^{2 x}\right )}{2 a}+\frac {b \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c e^x\right )}{a} \\ & = \frac {x}{a}+\frac {b \tanh ^{-1}\left (\frac {b+2 c e^x}{\sqrt {b^2-4 a c}}\right )}{a \sqrt {b^2-4 a c}}-\frac {\log \left (a+b e^x+c e^{2 x}\right )}{2 a} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.03 \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=-\frac {\frac {2 b \arctan \left (\frac {b+2 c e^x}{\sqrt {-b^2+4 a c}}\right )}{\sqrt {-b^2+4 a c}}-2 \log \left (e^x\right )+\log \left (a+e^x \left (b+c e^x\right )\right )}{2 a} \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.09 (sec) , antiderivative size = 66, normalized size of antiderivative = 0.99

method result size
default \(-\frac {\ln \left (a +b \,{\mathrm e}^{x}+c \,{\mathrm e}^{2 x}\right )}{2 a}-\frac {b \arctan \left (\frac {b +2 c \,{\mathrm e}^{x}}{\sqrt {4 c a -b^{2}}}\right )}{a \sqrt {4 c a -b^{2}}}+\frac {\ln \left ({\mathrm e}^{x}\right )}{a}\) \(66\)
risch \(\frac {4 x c a}{4 a^{2} c -a \,b^{2}}-\frac {x \,b^{2}}{4 a^{2} c -a \,b^{2}}-\frac {2 \ln \left ({\mathrm e}^{x}-\frac {-b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 c b}\right ) c}{4 c a -b^{2}}+\frac {\ln \left ({\mathrm e}^{x}-\frac {-b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 c b}\right ) b^{2}}{2 a \left (4 c a -b^{2}\right )}+\frac {\ln \left ({\mathrm e}^{x}-\frac {-b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 c b}\right ) \sqrt {-4 a \,b^{2} c +b^{4}}}{2 a \left (4 c a -b^{2}\right )}-\frac {2 \ln \left ({\mathrm e}^{x}+\frac {b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 c b}\right ) c}{4 c a -b^{2}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 c b}\right ) b^{2}}{2 a \left (4 c a -b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{x}+\frac {b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 c b}\right ) \sqrt {-4 a \,b^{2} c +b^{4}}}{2 a \left (4 c a -b^{2}\right )}\) \(353\)

[In]

int(1/(a+b*exp(x)+c*exp(2*x)),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 219, normalized size of antiderivative = 3.27 \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=\left [\frac {\sqrt {b^{2} - 4 \, a c} b \log \left (\frac {2 \, c^{2} e^{\left (2 \, x\right )} + 2 \, b c e^{x} + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c e^{x} + b\right )}}{c e^{\left (2 \, x\right )} + b e^{x} + a}\right ) + 2 \, {\left (b^{2} - 4 \, a c\right )} x - {\left (b^{2} - 4 \, a c\right )} \log \left (c e^{\left (2 \, x\right )} + b e^{x} + a\right )}{2 \, {\left (a b^{2} - 4 \, a^{2} c\right )}}, \frac {2 \, \sqrt {-b^{2} + 4 \, a c} b \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c e^{x} + b\right )}}{b^{2} - 4 \, a c}\right ) + 2 \, {\left (b^{2} - 4 \, a c\right )} x - {\left (b^{2} - 4 \, a c\right )} \log \left (c e^{\left (2 \, x\right )} + b e^{x} + a\right )}{2 \, {\left (a b^{2} - 4 \, a^{2} c\right )}}\right ] \]

[In]

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

[Out]

[1/2*(sqrt(b^2 - 4*a*c)*b*log((2*c^2*e^(2*x) + 2*b*c*e^x + b^2 - 2*a*c + sqrt(b^2 - 4*a*c)*(2*c*e^x + b))/(c*e
^(2*x) + b*e^x + a)) + 2*(b^2 - 4*a*c)*x - (b^2 - 4*a*c)*log(c*e^(2*x) + b*e^x + a))/(a*b^2 - 4*a^2*c), 1/2*(2
*sqrt(-b^2 + 4*a*c)*b*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*e^x + b)/(b^2 - 4*a*c)) + 2*(b^2 - 4*a*c)*x - (b^2 - 4*a
*c)*log(c*e^(2*x) + b*e^x + a))/(a*b^2 - 4*a^2*c)]

Sympy [A] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.94 \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=\operatorname {RootSum} {\left (z^{2} \cdot \left (4 a^{2} c - a b^{2}\right ) + z \left (4 a c - b^{2}\right ) + c, \left ( i \mapsto i \log {\left (e^{x} + \frac {- 4 i a^{2} c + i a b^{2} - 2 a c + b^{2}}{b c} \right )} \right )\right )} + \frac {x}{a} \]

[In]

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

[Out]

RootSum(_z**2*(4*a**2*c - a*b**2) + _z*(4*a*c - b**2) + c, Lambda(_i, _i*log(exp(x) + (-4*_i*a**2*c + _i*a*b**
2 - 2*a*c + b**2)/(b*c)))) + x/a

Maxima [F(-2)]

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.94 \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=-\frac {b \arctan \left (\frac {2 \, c e^{x} + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} a} + \frac {x}{a} - \frac {\log \left (c e^{\left (2 \, x\right )} + b e^{x} + a\right )}{2 \, a} \]

[In]

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

[Out]

-b*arctan((2*c*e^x + b)/sqrt(-b^2 + 4*a*c))/(sqrt(-b^2 + 4*a*c)*a) + x/a - 1/2*log(c*e^(2*x) + b*e^x + a)/a

Mupad [B] (verification not implemented)

Time = 0.39 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.94 \[ \int \frac {1}{a+b e^x+c e^{2 x}} \, dx=\frac {x}{a}-\frac {\ln \left (a+b\,{\mathrm {e}}^x+c\,{\mathrm {e}}^{2\,x}\right )}{2\,a}-\frac {b\,\mathrm {atan}\left (\frac {b+2\,c\,{\mathrm {e}}^x}{\sqrt {4\,a\,c-b^2}}\right )}{a\,\sqrt {4\,a\,c-b^2}} \]

[In]

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

[Out]

x/a - log(a + b*exp(x) + c*exp(2*x))/(2*a) - (b*atan((b + 2*c*exp(x))/(4*a*c - b^2)^(1/2)))/(a*(4*a*c - b^2)^(
1/2))