3.2.7 \(\int \frac {\cosh ^2(x)}{1+\coth (x)} \, dx\) [107]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.364, Rules used = {3597, 862, 90, 213} \begin {gather*} \frac {x}{8}-\frac {1}{8 (1-\coth (x))}-\frac {1}{4 (\coth (x)+1)}+\frac {1}{8 (\coth (x)+1)^2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

x/8 - 1/(8*(1 - Coth[x])) + 1/(8*(1 + Coth[x])^2) - 1/(4*(1 + Coth[x]))

Rule 90

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandI
ntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, p}, x] && IntegersQ[m, n] &&
(IntegerQ[p] || (GtQ[m, 0] && GeQ[n, -1]))

Rule 213

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

Rule 862

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

Rule 3597

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 24, normalized size = 0.63 \begin {gather*} \frac {1}{32} (4 x+4 \cosh (2 x)+\cosh (4 x)-\sinh (4 x)) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(77\) vs. \(2(30)=60\).
time = 0.40, size = 78, normalized size = 2.05

method result size
risch \(\frac {x}{8}+\frac {{\mathrm e}^{2 x}}{16}+\frac {{\mathrm e}^{-2 x}}{16}+\frac {{\mathrm e}^{-4 x}}{32}\) \(23\)
default \(\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 {1}{\left (\tanh \left (\frac {x}{2}\right )+1\right )^{2}}-\frac {1}{2 \left (\tanh \left (\frac {x}{2}\right )+1\right )}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{8}+\frac {1}{4 \left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}+\frac {1}{4 \tanh \left (\frac {x}{2}\right )-4}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{8}\) \(78\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cosh(x)^2/(1+coth(x)),x,method=_RETURNVERBOSE)

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.26, size = 22, normalized size = 0.58 \begin {gather*} \frac {1}{8} \, x + \frac {1}{16} \, e^{\left (2 \, x\right )} + \frac {1}{16} \, e^{\left (-2 \, x\right )} + \frac {1}{32} \, e^{\left (-4 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 51, normalized size = 1.34 \begin {gather*} \frac {3 \, \cosh \left (x\right )^{3} + 9 \, \cosh \left (x\right ) \sinh \left (x\right )^{2} + \sinh \left (x\right )^{3} + 2 \, {\left (2 \, x + 1\right )} \cosh \left (x\right ) + {\left (3 \, \cosh \left (x\right )^{2} + 4 \, x - 2\right )} \sinh \left (x\right )}{32 \, {\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.40, size = 30, normalized size = 0.79 \begin {gather*} -\frac {1}{32} \, {\left (3 \, e^{\left (4 \, x\right )} - 2 \, e^{\left (2 \, x\right )} - 1\right )} e^{\left (-4 \, x\right )} + \frac {1}{8} \, x + \frac {1}{16} \, e^{\left (2 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.11, size = 22, normalized size = 0.58 \begin {gather*} \frac {x}{8}+\frac {{\mathrm {e}}^{-2\,x}}{16}+\frac {{\mathrm {e}}^{2\,x}}{16}+\frac {{\mathrm {e}}^{-4\,x}}{32} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________