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

Optimal. Leaf size=17 \[ x+\frac{1}{e^x+1}-\log \left (e^x+1\right ) \]

[Out]

(1 + E^x)^(-1) + x - Log[1 + E^x]

________________________________________________________________________________________

Rubi [A]  time = 0.0147249, antiderivative size = 17, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {2282, 44} \[ x+\frac{1}{e^x+1}-\log \left (e^x+1\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(1 + E^x)^(-1) + x - Log[1 + E^x]

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 44

Int[((a_) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*
x)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && L
tQ[m + n + 2, 0])

Rubi steps

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

Mathematica [A]  time = 0.0141032, size = 17, normalized size = 1. \[ x+\frac{1}{e^x+1}-\log \left (e^x+1\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(1 + E^x)^(-1) + x - Log[1 + E^x]

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

ln(exp(x))+1/(1+exp(x))-ln(1+exp(x))

________________________________________________________________________________________

Maxima [A]  time = 0.977773, size = 20, normalized size = 1.18 \begin{align*} x + \frac{1}{e^{x} + 1} - \log \left (e^{x} + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x + 1/(e^x + 1) - log(e^x + 1)

________________________________________________________________________________________

Fricas [A]  time = 1.55972, size = 70, normalized size = 4.12 \begin{align*} \frac{x e^{x} -{\left (e^{x} + 1\right )} \log \left (e^{x} + 1\right ) + x + 1}{e^{x} + 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.079514, size = 14, normalized size = 0.82 \begin{align*} x - \log{\left (e^{x} + 1 \right )} + \frac{1}{e^{x} + 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.32998, size = 20, normalized size = 1.18 \begin{align*} x + \frac{1}{e^{x} + 1} - \log \left (e^{x} + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x + 1/(e^x + 1) - log(e^x + 1)