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

Optimal. Leaf size=56 \[ -x+\frac {1}{10} \left (5+\sqrt {5}\right ) \log \left (2 e^x+1-\sqrt {5}\right )+\frac {1}{10} \left (5-\sqrt {5}\right ) \log \left (2 e^x+1+\sqrt {5}\right ) \]

[Out]

-x+1/10*ln(1+2*exp(x)+5^(1/2))*(5-5^(1/2))+1/10*ln(1+2*exp(x)-5^(1/2))*(5+5^(1/2))

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 56, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.417, Rules used = {2282, 705, 29, 632, 31} \[ -x+\frac {1}{10} \left (5+\sqrt {5}\right ) \log \left (2 e^x+1-\sqrt {5}\right )+\frac {1}{10} \left (5-\sqrt {5}\right ) \log \left (2 e^x+1+\sqrt {5}\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x + ((5 + Sqrt[5])*Log[1 - Sqrt[5] + 2*E^x])/10 + ((5 - Sqrt[5])*Log[1 + Sqrt[5] + 2*E^x])/10

Rule 29

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

Rule 31

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

Rule 632

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[
(c*d - e*(b/2 - q/2))/q, Int[1/(b/2 - q/2 + c*x), x], x] - Dist[(c*d - e*(b/2 + q/2))/q, Int[1/(b/2 + q/2 + c*
x), 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 705

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 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]]]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 44, normalized size = 0.79 \[ -x+\frac {1}{2} \log \left (-e^x-e^{2 x}+1\right )-\frac {\tanh ^{-1}\left (\frac {2 e^x+1}{\sqrt {5}}\right )}{\sqrt {5}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x - ArcTanh[(1 + 2*E^x)/Sqrt[5]]/Sqrt[5] + Log[1 - E^x - E^(2*x)]/2

________________________________________________________________________________________

fricas [A]  time = 0.42, size = 53, normalized size = 0.95 \[ \frac {1}{10} \, \sqrt {5} \log \left (-\frac {2 \, {\left (\sqrt {5} - 1\right )} e^{x} + \sqrt {5} - 2 \, e^{\left (2 \, x\right )} - 3}{e^{\left (2 \, x\right )} + e^{x} - 1}\right ) - x + \frac {1}{2} \, \log \left (e^{\left (2 \, x\right )} + e^{x} - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.36, size = 46, normalized size = 0.82 \[ \frac {1}{10} \, \sqrt {5} \log \left (\frac {{\left | -\sqrt {5} + 2 \, e^{x} + 1 \right |}}{\sqrt {5} + 2 \, e^{x} + 1}\right ) - x + \frac {1}{2} \, \log \left ({\left | e^{\left (2 \, x\right )} + e^{x} - 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/10*sqrt(5)*log(abs(-sqrt(5) + 2*e^x + 1)/(sqrt(5) + 2*e^x + 1)) - x + 1/2*log(abs(e^(2*x) + e^x - 1))

________________________________________________________________________________________

maple [A]  time = 0.02, size = 35, normalized size = 0.62 \[ -\frac {\sqrt {5}\, \arctanh \left (\frac {\left (2 \,{\mathrm e}^{x}+1\right ) \sqrt {5}}{5}\right )}{5}+\frac {\ln \left ({\mathrm e}^{x}+{\mathrm e}^{2 x}-1\right )}{2}-\ln \left ({\mathrm e}^{x}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*ln(-1+exp(x)+exp(x)^2)-1/5*5^(1/2)*arctanh(1/5*(1+2*exp(x))*5^(1/2))-ln(exp(x))

________________________________________________________________________________________

maxima [A]  time = 1.86, size = 43, normalized size = 0.77 \[ \frac {1}{10} \, \sqrt {5} \log \left (-\frac {\sqrt {5} - 2 \, e^{x} - 1}{\sqrt {5} + 2 \, e^{x} + 1}\right ) - x + \frac {1}{2} \, \log \left (e^{\left (2 \, x\right )} + e^{x} - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/10*sqrt(5)*log(-(sqrt(5) - 2*e^x - 1)/(sqrt(5) + 2*e^x + 1)) - x + 1/2*log(e^(2*x) + e^x - 1)

________________________________________________________________________________________

mupad [B]  time = 3.70, size = 32, normalized size = 0.57 \[ \frac {\ln \left ({\mathrm {e}}^{2\,x}+{\mathrm {e}}^x-1\right )}{2}-x-\frac {\sqrt {5}\,\mathrm {atanh}\left (\frac {\sqrt {5}\,\left (2\,{\mathrm {e}}^x+1\right )}{5}\right )}{5} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(exp(2*x) + exp(x) - 1)/2 - x - (5^(1/2)*atanh((5^(1/2)*(2*exp(x) + 1))/5))/5

________________________________________________________________________________________

sympy [A]  time = 0.13, size = 22, normalized size = 0.39 \[ - x + \operatorname {RootSum} {\left (5 z^{2} - 5 z + 1, \left (i \mapsto i \log {\left (- 5 i + e^{x} + 3 \right )} \right )\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x + RootSum(5*_z**2 - 5*_z + 1, Lambda(_i, _i*log(-5*_i + exp(x) + 3)))

________________________________________________________________________________________