\(\int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx\) [110]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 11, antiderivative size = 15 \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=-\log (1+\coth (x))-\log (\tanh (x))+\tanh (x) \]

[Out]

-ln(1+coth(x))-ln(tanh(x))+tanh(x)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3597, 46} \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=\tanh (x)-\log (\tanh (x))-\log (\coth (x)+1) \]

[In]

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

[Out]

-Log[1 + Coth[x]] - Log[Tanh[x]] + Tanh[x]

Rule 46

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] && Lt
Q[m + n + 2, 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*} \text {integral}& = -\text {Subst}\left (\int \frac {1}{x^2 (1+x)} \, dx,x,\coth (x)\right ) \\ & = -\text {Subst}\left (\int \left (\frac {1}{x^2}-\frac {1}{x}+\frac {1}{1+x}\right ) \, dx,x,\coth (x)\right ) \\ & = -\log (1+\coth (x))-\log (\tanh (x))+\tanh (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.08 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.67 \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=-\log (1+\tanh (x))+\tanh (x) \]

[In]

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

[Out]

-Log[1 + Tanh[x]] + Tanh[x]

Maple [A] (verified)

Time = 0.88 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.47

method result size
risch \(-2 x -\frac {2}{1+{\mathrm e}^{2 x}}+\ln \left (1+{\mathrm e}^{2 x}\right )\) \(22\)
default \(-2 \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )+\frac {2 \tanh \left (\frac {x}{2}\right )}{1+\tanh \left (\frac {x}{2}\right )^{2}}+\ln \left (1+\tanh \left (\frac {x}{2}\right )^{2}\right )\) \(36\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (15) = 30\).

Time = 0.26 (sec) , antiderivative size = 78, normalized size of antiderivative = 5.20 \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=-\frac {2 \, x \cosh \left (x\right )^{2} + 4 \, x \cosh \left (x\right ) \sinh \left (x\right ) + 2 \, x \sinh \left (x\right )^{2} - {\left (\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2} + 1\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 2 \, x + 2}{\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2} + 1} \]

[In]

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

[Out]

-(2*x*cosh(x)^2 + 4*x*cosh(x)*sinh(x) + 2*x*sinh(x)^2 - (cosh(x)^2 + 2*cosh(x)*sinh(x) + sinh(x)^2 + 1)*log(2*
cosh(x)/(cosh(x) - sinh(x))) + 2*x + 2)/(cosh(x)^2 + 2*cosh(x)*sinh(x) + sinh(x)^2 + 1)

Sympy [F]

\[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=\int \frac {\operatorname {sech}^{2}{\left (x \right )}}{\coth {\left (x \right )} + 1}\, dx \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.20 \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=\frac {2}{e^{\left (-2 \, x\right )} + 1} + \log \left (e^{\left (-2 \, x\right )} + 1\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.80 \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=-2 \, x - \frac {e^{\left (2 \, x\right )} + 3}{e^{\left (2 \, x\right )} + 1} + \log \left (e^{\left (2 \, x\right )} + 1\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 1.85 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.40 \[ \int \frac {\text {sech}^2(x)}{1+\coth (x)} \, dx=\ln \left ({\mathrm {e}}^{2\,x}+1\right )-2\,x-\frac {2}{{\mathrm {e}}^{2\,x}+1} \]

[In]

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

[Out]

log(exp(2*x) + 1) - 2*x - 2/(exp(2*x) + 1)