### 3.331 $$\int \frac{1}{1-e^{-x}+2 e^x} \, dx$$

Optimal. Leaf size=23 $\frac{1}{3} \log \left (1-2 e^x\right )-\frac{1}{3} \log \left (e^x+1\right )$

[Out]

Log[1 - 2*E^x]/3 - Log[1 + E^x]/3

________________________________________________________________________________________

Rubi [A]  time = 0.0168223, antiderivative size = 23, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 16, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.188, Rules used = {2282, 616, 31} $\frac{1}{3} \log \left (1-2 e^x\right )-\frac{1}{3} \log \left (e^x+1\right )$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

Log[1 - 2*E^x]/3 - Log[1 + E^x]/3

Rule 2282

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 616

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

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rubi steps

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

Mathematica [A]  time = 0.0112246, size = 16, normalized size = 0.7 $-\frac{2}{3} \tanh ^{-1}\left (\frac{1}{3} \left (4 e^x+1\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(-2*ArcTanh[(1 + 4*E^x)/3])/3

________________________________________________________________________________________

Maple [A]  time = 0.005, size = 18, normalized size = 0.8 \begin{align*} -{\frac{\ln \left ( 1+{{\rm e}^{x}} \right ) }{3}}+{\frac{\ln \left ( 2\,{{\rm e}^{x}}-1 \right ) }{3}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/3*ln(1+exp(x))+1/3*ln(2*exp(x)-1)

________________________________________________________________________________________

Maxima [A]  time = 0.933128, size = 26, normalized size = 1.13 \begin{align*} -\frac{1}{3} \, \log \left (e^{\left (-x\right )} + 1\right ) + \frac{1}{3} \, \log \left (e^{\left (-x\right )} - 2\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.93344, size = 53, normalized size = 2.3 \begin{align*} \frac{1}{3} \, \log \left (2 \, e^{x} - 1\right ) - \frac{1}{3} \, \log \left (e^{x} + 1\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.108245, size = 19, normalized size = 0.83 \begin{align*} \frac{\log{\left (-2 + e^{- x} \right )}}{3} - \frac{\log{\left (1 + e^{- x} \right )}}{3} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(-2 + exp(-x))/3 - log(1 + exp(-x))/3

________________________________________________________________________________________

Giac [A]  time = 1.04985, size = 24, normalized size = 1.04 \begin{align*} -\frac{1}{3} \, \log \left (e^{x} + 1\right ) + \frac{1}{3} \, \log \left ({\left | 2 \, e^{x} - 1 \right |}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/3*log(e^x + 1) + 1/3*log(abs(2*e^x - 1))