3.639 \(\int (-e^{-x}+e^x) \log (1+e^{2 x}) \, dx\)

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0538533, antiderivative size = 32, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 6, integrand size = 20, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.3, Rules used = {2282, 2476, 2448, 321, 203, 2455} \[ -2 e^x+e^{-x} \log \left (e^{2 x}+1\right )+e^x \log \left (e^{2 x}+1\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-2*E^x + Log[1 + E^(2*x)]/E^x + E^x*Log[1 + E^(2*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 2476

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_)^(n_))^(p_.)]*(b_.))^(q_.)*(x_)^(m_.)*((f_) + (g_.)*(x_)^(s_))^(r_.),
 x_Symbol] :> Int[ExpandIntegrand[(a + b*Log[c*(d + e*x^n)^p])^q, x^m*(f + g*x^s)^r, x], x] /; FreeQ[{a, b, c,
 d, e, f, g, m, n, p, q, r, s}, x] && IGtQ[q, 0] && IntegerQ[m] && IntegerQ[r] && IntegerQ[s]

Rule 2448

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_))^(p_.)], x_Symbol] :> Simp[x*Log[c*(d + e*x^n)^p], x] - Dist[e*n*p, Int[
x^n/(d + e*x^n), x], x] /; FreeQ[{c, d, e, n, p}, x]

Rule 321

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(c^(n - 1)*(c*x)^(m - n + 1)*(a + b*x^n
)^(p + 1))/(b*(m + n*p + 1)), x] - Dist[(a*c^n*(m - n + 1))/(b*(m + n*p + 1)), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 203

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

Rule 2455

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_)^(n_))^(p_.)]*(b_.))*((f_.)*(x_))^(m_.), x_Symbol] :> Simp[((f*x)^(m
+ 1)*(a + b*Log[c*(d + e*x^n)^p]))/(f*(m + 1)), x] - Dist[(b*e*n*p)/(f*(m + 1)), Int[(x^(n - 1)*(f*x)^(m + 1))
/(d + e*x^n), x], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && NeQ[m, -1]

Rubi steps

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

Mathematica [A]  time = 0.0313868, size = 24, normalized size = 0.75 \[ \left (e^{-x}+e^x\right ) \log \left (e^{2 x}+1\right )-2 e^x \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 0.952153, size = 27, normalized size = 0.84 \begin{align*}{\left (e^{\left (-x\right )} + e^{x}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right ) - 2 \, e^{x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.39275, size = 72, normalized size = 2.25 \begin{align*}{\left ({\left (e^{\left (2 \, x\right )} + 1\right )} \log \left (e^{\left (2 \, x\right )} + 1\right ) - 2 \, e^{\left (2 \, x\right )}\right )} e^{\left (-x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ShapeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ShapeError

________________________________________________________________________________________

Giac [A]  time = 1.061, size = 27, normalized size = 0.84 \begin{align*}{\left (e^{\left (-x\right )} + e^{x}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right ) - 2 \, e^{x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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