### 3.1046 $$\int \frac{\cosh ^2(x)}{1+e^x} \, dx$$

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0488001, antiderivative size = 39, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 12, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.25, Rules used = {2282, 12, 894} $\frac{3 x}{4}-\frac{e^{-2 x}}{8}+\frac{e^{-x}}{4}+\frac{e^x}{4}-\log \left (e^x+1\right )$

Antiderivative was successfully veriﬁed.

[In]

Int[Cosh[x]^2/(1 + E^x),x]

[Out]

-1/(8*E^(2*x)) + 1/(4*E^x) + E^x/4 + (3*x)/4 - 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 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 894

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIn
tegrand[(d + e*x)^m*(f + g*x)^n*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] &&
NeQ[c*d^2 + a*e^2, 0] && IntegerQ[p] && ((EqQ[p, 1] && IntegersQ[m, n]) || (ILtQ[m, 0] && ILtQ[n, 0]))

Rubi steps

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

Mathematica [A]  time = 0.0322403, size = 33, normalized size = 0.85 $\frac{1}{4} \left (3 x-\frac{e^{-2 x}}{2}+e^{-x}+e^x-4 \log \left (e^x+1\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

Integrate[Cosh[x]^2/(1 + E^x),x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.011, size = 48, normalized size = 1.2 \begin{align*} -{\frac{1}{2} \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-2}}+ \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-1}+{\frac{3}{4}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) }-{\frac{1}{2} \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) ^{-1}}+{\frac{1}{4}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) } \end{align*}

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

[In]

int(cosh(x)^2/(exp(x)+1),x)

[Out]

-1/2/(tanh(1/2*x)+1)^2+1/(tanh(1/2*x)+1)+3/4*ln(tanh(1/2*x)+1)-1/2/(tanh(1/2*x)-1)+1/4*ln(tanh(1/2*x)-1)

________________________________________________________________________________________

Maxima [A]  time = 1.03582, size = 36, normalized size = 0.92 \begin{align*} \frac{1}{8} \,{\left (2 \, e^{x} - 1\right )} e^{\left (-2 \, x\right )} + \frac{3}{4} \, x + \frac{1}{4} \, e^{x} - \log \left (e^{x} + 1\right ) \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.09387, size = 346, normalized size = 8.87 \begin{align*} \frac{6 \, x \cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right )^{3} + 6 \,{\left (x + \cosh \left (x\right )\right )} \sinh \left (x\right )^{2} + 2 \, \sinh \left (x\right )^{3} - 8 \,{\left (\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2}\right )} \log \left (\cosh \left (x\right ) + \sinh \left (x\right ) + 1\right ) + 2 \,{\left (6 \, x \cosh \left (x\right ) + 3 \, \cosh \left (x\right )^{2} + 1\right )} \sinh \left (x\right ) + 2 \, \cosh \left (x\right ) - 1}{8 \,{\left (\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2}\right )}} \end{align*}

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

[In]

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

[Out]

1/8*(6*x*cosh(x)^2 + 2*cosh(x)^3 + 6*(x + cosh(x))*sinh(x)^2 + 2*sinh(x)^3 - 8*(cosh(x)^2 + 2*cosh(x)*sinh(x)
+ sinh(x)^2)*log(cosh(x) + sinh(x) + 1) + 2*(6*x*cosh(x) + 3*cosh(x)^2 + 1)*sinh(x) + 2*cosh(x) - 1)/(cosh(x)^
2 + 2*cosh(x)*sinh(x) + sinh(x)^2)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\cosh ^{2}{\left (x \right )}}{e^{x} + 1}\, dx \end{align*}

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

[In]

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

[Out]

Integral(cosh(x)**2/(exp(x) + 1), x)

________________________________________________________________________________________

Giac [A]  time = 1.13807, size = 36, normalized size = 0.92 \begin{align*} \frac{1}{8} \,{\left (2 \, e^{x} - 1\right )} e^{\left (-2 \, x\right )} + \frac{3}{4} \, x + \frac{1}{4} \, e^{x} - \log \left (e^{x} + 1\right ) \end{align*}

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

[In]

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

[Out]

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