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/exp(2*x)+1/4/exp(x)+1/4*exp(x)+3/4*x-ln(1+exp(x))

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, 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 verified.

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

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 {\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.03, 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 verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [B]  time = 0.42, size = 95, normalized size = 2.44 \[ \frac {6 \, x \cosh \relax (x)^{2} + 2 \, \cosh \relax (x)^{3} + 6 \, {\left (x + \cosh \relax (x)\right )} \sinh \relax (x)^{2} + 2 \, \sinh \relax (x)^{3} - 8 \, {\left (\cosh \relax (x)^{2} + 2 \, \cosh \relax (x) \sinh \relax (x) + \sinh \relax (x)^{2}\right )} \log \left (\cosh \relax (x) + \sinh \relax (x) + 1\right ) + 2 \, {\left (6 \, x \cosh \relax (x) + 3 \, \cosh \relax (x)^{2} + 1\right )} \sinh \relax (x) + 2 \, \cosh \relax (x) - 1}{8 \, {\left (\cosh \relax (x)^{2} + 2 \, \cosh \relax (x) \sinh \relax (x) + \sinh \relax (x)^{2}\right )}} \]

Verification 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)

________________________________________________________________________________________

giac [A]  time = 0.11, size = 27, normalized size = 0.69 \[ \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 ) \]

Verification 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)

________________________________________________________________________________________

maple [A]  time = 0.08, size = 48, normalized size = 1.23 \[ -\frac {1}{2 \left (\tanh \left (\frac {x}{2}\right )-1\right )}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{4}-\frac {1}{2 \left (\tanh \left (\frac {x}{2}\right )+1\right )^{2}}+\frac {1}{\tanh \left (\frac {x}{2}\right )+1}+\frac {3 \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{4} \]

Verification 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)+1/4*ln(tanh(1/2*x)-1)-1/2/(tanh(1/2*x)+1)^2+1/(tanh(1/2*x)+1)+3/4*ln(tanh(1/2*x)+1)

________________________________________________________________________________________

maxima [A]  time = 0.31, size = 27, normalized size = 0.69 \[ \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 ) \]

Verification 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)

________________________________________________________________________________________

mupad [B]  time = 0.06, size = 27, normalized size = 0.69 \[ \frac {3\,x}{4}+\frac {{\mathrm {e}}^{-x}}{4}-\frac {{\mathrm {e}}^{-2\,x}}{8}-\ln \left ({\mathrm {e}}^x+1\right )+\frac {{\mathrm {e}}^x}{4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cosh ^{2}{\relax (x )}}{e^{x} + 1}\, dx \]

Verification 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)

________________________________________________________________________________________