3.93 \(\int \frac {\cosh ^2(x)}{1+\tanh (x)} \, dx\)

Optimal. Leaf size=38 \[ \frac {3 x}{8}+\frac {1}{8 (1-\tanh (x))}-\frac {1}{4 (\tanh (x)+1)}-\frac {1}{8 (\tanh (x)+1)^2} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3487, 44, 207} \[ \frac {3 x}{8}+\frac {1}{8 (1-\tanh (x))}-\frac {1}{4 (\tanh (x)+1)}-\frac {1}{8 (\tanh (x)+1)^2} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 207

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

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 30, normalized size = 0.79 \[ \frac {1}{32} (12 x+8 \sinh (2 x)+\sinh (4 x)-4 \cosh (2 x)-\cosh (4 x)) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(12*x - 4*Cosh[2*x] - Cosh[4*x] + 8*Sinh[2*x] + Sinh[4*x])/32

________________________________________________________________________________________

fricas [A]  time = 0.38, size = 52, normalized size = 1.37 \[ \frac {\cosh \relax (x)^{3} + 3 \, \cosh \relax (x) \sinh \relax (x)^{2} + 3 \, \sinh \relax (x)^{3} + 6 \, {\left (2 \, x - 1\right )} \cosh \relax (x) + 3 \, {\left (3 \, \cosh \relax (x)^{2} + 4 \, x + 2\right )} \sinh \relax (x)}{32 \, {\left (\cosh \relax (x) + \sinh \relax (x)\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/32*(cosh(x)^3 + 3*cosh(x)*sinh(x)^2 + 3*sinh(x)^3 + 6*(2*x - 1)*cosh(x) + 3*(3*cosh(x)^2 + 4*x + 2)*sinh(x))
/(cosh(x) + sinh(x))

________________________________________________________________________________________

giac [A]  time = 0.13, size = 30, normalized size = 0.79 \[ -\frac {1}{32} \, {\left (9 \, e^{\left (4 \, x\right )} + 6 \, e^{\left (2 \, x\right )} + 1\right )} e^{\left (-4 \, x\right )} + \frac {3}{8} \, x + \frac {1}{16} \, e^{\left (2 \, x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/32*(9*e^(4*x) + 6*e^(2*x) + 1)*e^(-4*x) + 3/8*x + 1/16*e^(2*x)

________________________________________________________________________________________

maple [B]  time = 0.10, size = 76, normalized size = 2.00 \[ \frac {1}{4 \left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}+\frac {1}{4 \tanh \left (\frac {x}{2}\right )-4}-\frac {3 \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{8}-\frac {1}{2 \left (\tanh \left (\frac {x}{2}\right )+1\right )^{4}}+\frac {1}{\left (\tanh \left (\frac {x}{2}\right )+1\right )^{3}}-\frac {3}{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 )}{8} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.31, size = 22, normalized size = 0.58 \[ \frac {3}{8} \, x + \frac {1}{16} \, e^{\left (2 \, x\right )} - \frac {3}{16} \, e^{\left (-2 \, x\right )} - \frac {1}{32} \, e^{\left (-4 \, x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.13, size = 22, normalized size = 0.58 \[ \frac {3\,x}{8}-\frac {3\,{\mathrm {e}}^{-2\,x}}{16}+\frac {{\mathrm {e}}^{2\,x}}{16}-\frac {{\mathrm {e}}^{-4\,x}}{32} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(3*x)/8 - (3*exp(-2*x))/16 + exp(2*x)/16 - exp(-4*x)/32

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________