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

   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 = 9, antiderivative size = 10 \[ \int \frac {\text {sech}(x)}{1+\coth (x)} \, dx=\arctan (\sinh (x))+\cosh (x)-\sinh (x) \]

[Out]

arctan(sinh(x))+cosh(x)-sinh(x)

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.778, Rules used = {3599, 3187, 3186, 2718, 2672, 327, 209} \[ \int \frac {\text {sech}(x)}{1+\coth (x)} \, dx=\arctan (\sinh (x))-\sinh (x)+\cosh (x) \]

[In]

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

[Out]

ArcTan[Sinh[x]] + Cosh[x] - Sinh[x]

Rule 209

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

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3186

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_
.) + (d_.)*(x_)])^(p_.), x_Symbol] :> Int[ExpandTrig[cos[c + d*x]^m*sin[c + d*x]^n*(a*cos[c + d*x] + b*sin[c +
 d*x])^p, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IGtQ[p, 0]

Rule 3187

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_
.) + (d_.)*(x_)])^(p_), x_Symbol] :> Dist[a^p*b^p, Int[(Cos[c + d*x]^m*Sin[c + d*x]^n)/(b*Cos[c + d*x] + a*Sin
[c + d*x])^p, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && EqQ[a^2 + b^2, 0] && ILtQ[p, 0]

Rule 3599

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[Sin[e + f*x]^
m*((a*Cos[e + f*x] + b*Sin[e + f*x])^n/Cos[e + f*x]^n), x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
 ILtQ[n, 0] && ((LtQ[m, 5] && GtQ[n, -4]) || (EqQ[m, 5] && EqQ[n, -1]))

Rubi steps \begin{align*} \text {integral}& = -\left (i \int \frac {\tanh (x)}{-i \cosh (x)-i \sinh (x)} \, dx\right ) \\ & = -\int (-\cosh (x)+\sinh (x)) \tanh (x) \, dx \\ & = i \int (-i \sinh (x)+i \sinh (x) \tanh (x)) \, dx \\ & = \int \sinh (x) \, dx-\int \sinh (x) \tanh (x) \, dx \\ & = \cosh (x)-\text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,\sinh (x)\right ) \\ & = \cosh (x)-\sinh (x)+\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\sinh (x)\right ) \\ & = \arctan (\sinh (x))+\cosh (x)-\sinh (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.60 \[ \int \frac {\text {sech}(x)}{1+\coth (x)} \, dx=2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )+\cosh (x)-\sinh (x) \]

[In]

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

[Out]

2*ArcTan[Tanh[x/2]] + Cosh[x] - Sinh[x]

Maple [A] (verified)

Time = 0.33 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.90

method result size
default \(\frac {2}{\tanh \left (\frac {x}{2}\right )+1}+2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )\) \(19\)
risch \({\mathrm e}^{-x}+i \ln \left ({\mathrm e}^{x}+i\right )-i \ln \left ({\mathrm e}^{x}-i\right )\) \(24\)

[In]

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

[Out]

2/(tanh(1/2*x)+1)+2*arctan(tanh(1/2*x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 23 vs. \(2 (10) = 20\).

Time = 0.26 (sec) , antiderivative size = 23, normalized size of antiderivative = 2.30 \[ \int \frac {\text {sech}(x)}{1+\coth (x)} \, dx=\frac {2 \, {\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) + 1}{\cosh \left (x\right ) + \sinh \left (x\right )} \]

[In]

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

[Out]

(2*(cosh(x) + sinh(x))*arctan(cosh(x) + sinh(x)) + 1)/(cosh(x) + sinh(x))

Sympy [F]

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

-2*arctan(e^(-x)) + e^(-x)

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

2*arctan(e^x) + e^(-x)

Mupad [B] (verification not implemented)

Time = 1.86 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int \frac {\text {sech}(x)}{1+\coth (x)} \, dx={\mathrm {e}}^{-x}+2\,\mathrm {atan}\left ({\mathrm {e}}^x\right ) \]

[In]

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

[Out]

exp(-x) + 2*atan(exp(x))