3.2.19 \(\int \frac {\text {sech}^2(x)}{a+b \coth (x)} \, dx\) [119]

Optimal. Leaf size=29 \[ -\frac {b \log (a+b \coth (x))}{a^2}-\frac {b \log (\tanh (x))}{a^2}+\frac {\tanh (x)}{a} \]

[Out]

-b*ln(a+b*coth(x))/a^2-b*ln(tanh(x))/a^2+tanh(x)/a

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3597, 46} \begin {gather*} -\frac {b \log (\tanh (x))}{a^2}-\frac {b \log (a+b \coth (x))}{a^2}+\frac {\tanh (x)}{a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sech[x]^2/(a + b*Coth[x]),x]

[Out]

-((b*Log[a + b*Coth[x]])/a^2) - (b*Log[Tanh[x]])/a^2 + Tanh[x]/a

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*} \int \frac {\text {sech}^2(x)}{a+b \coth (x)} \, dx &=-\left (b \text {Subst}\left (\int \frac {1}{x^2 (a+x)} \, dx,x,b \coth (x)\right )\right )\\ &=-\left (b \text {Subst}\left (\int \left (\frac {1}{a x^2}-\frac {1}{a^2 x}+\frac {1}{a^2 (a+x)}\right ) \, dx,x,b \coth (x)\right )\right )\\ &=-\frac {b \log (a+b \coth (x))}{a^2}-\frac {b \log (\tanh (x))}{a^2}+\frac {\tanh (x)}{a}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 27, normalized size = 0.93 \begin {gather*} \frac {b \log (\cosh (x))-b \log (b \cosh (x)+a \sinh (x))+a \tanh (x)}{a^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sech[x]^2/(a + b*Coth[x]),x]

[Out]

(b*Log[Cosh[x]] - b*Log[b*Cosh[x] + a*Sinh[x]] + a*Tanh[x])/a^2

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(60\) vs. \(2(29)=58\).
time = 0.78, size = 61, normalized size = 2.10

method result size
risch \(-\frac {2}{a \left (1+{\mathrm e}^{2 x}\right )}-\frac {b \ln \left ({\mathrm e}^{2 x}-\frac {a -b}{a +b}\right )}{a^{2}}+\frac {b \ln \left (1+{\mathrm e}^{2 x}\right )}{a^{2}}\) \(51\)
default \(-\frac {2 \left (-\frac {a \tanh \left (\frac {x}{2}\right )}{\tanh ^{2}\left (\frac {x}{2}\right )+1}-\frac {b \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{2}\right )}{a^{2}}-\frac {b \ln \left (b \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+2 a \tanh \left (\frac {x}{2}\right )+b \right )}{a^{2}}\) \(61\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sech(x)^2/(a+b*coth(x)),x,method=_RETURNVERBOSE)

[Out]

-2/a^2*(-a*tanh(1/2*x)/(tanh(1/2*x)^2+1)-1/2*b*ln(tanh(1/2*x)^2+1))-b/a^2*ln(b*tanh(1/2*x)^2+2*a*tanh(1/2*x)+b
)

________________________________________________________________________________________

Maxima [A]
time = 0.50, size = 46, normalized size = 1.59 \begin {gather*} -\frac {b \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} + a + b\right )}{a^{2}} + \frac {b \log \left (e^{\left (-2 \, x\right )} + 1\right )}{a^{2}} + \frac {2}{a e^{\left (-2 \, x\right )} + a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)^2/(a+b*coth(x)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (29) = 58\).
time = 0.35, size = 117, normalized size = 4.03 \begin {gather*} -\frac {{\left (b \cosh \left (x\right )^{2} + 2 \, b \cosh \left (x\right ) \sinh \left (x\right ) + b \sinh \left (x\right )^{2} + b\right )} \log \left (\frac {2 \, {\left (b \cosh \left (x\right ) + a \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) - {\left (b \cosh \left (x\right )^{2} + 2 \, b \cosh \left (x\right ) \sinh \left (x\right ) + b \sinh \left (x\right )^{2} + b\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 2 \, a}{a^{2} \cosh \left (x\right )^{2} + 2 \, a^{2} \cosh \left (x\right ) \sinh \left (x\right ) + a^{2} \sinh \left (x\right )^{2} + a^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)^2/(a+b*coth(x)),x, algorithm="fricas")

[Out]

-((b*cosh(x)^2 + 2*b*cosh(x)*sinh(x) + b*sinh(x)^2 + b)*log(2*(b*cosh(x) + a*sinh(x))/(cosh(x) - sinh(x))) - (
b*cosh(x)^2 + 2*b*cosh(x)*sinh(x) + b*sinh(x)^2 + b)*log(2*cosh(x)/(cosh(x) - sinh(x))) + 2*a)/(a^2*cosh(x)^2
+ 2*a^2*cosh(x)*sinh(x) + a^2*sinh(x)^2 + a^2)

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)**2/(a+b*coth(x)),x)

[Out]

Integral(sech(x)**2/(a + b*coth(x)), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (29) = 58\).
time = 0.40, size = 76, normalized size = 2.62 \begin {gather*} -\frac {{\left (a b + b^{2}\right )} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} - a + b \right |}\right )}{a^{3} + a^{2} b} + \frac {b \log \left (e^{\left (2 \, x\right )} + 1\right )}{a^{2}} - \frac {b e^{\left (2 \, x\right )} + 2 \, a + b}{a^{2} {\left (e^{\left (2 \, x\right )} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)^2/(a+b*coth(x)),x, algorithm="giac")

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 1.58, size = 323, normalized size = 11.14 \begin {gather*} \frac {2\,\mathrm {atan}\left (\frac {b\,\left (a^4\,{\left (b^2\right )}^{3/2}-a^6\,\sqrt {b^2}\right )\,\left (b^6\,\sqrt {-a^4}-a\,b^5\,\sqrt {-a^4}-a^2\,b^4\,\sqrt {-a^4}+a^3\,b^3\,\sqrt {-a^4}+b^6\,{\mathrm {e}}^{2\,x}\,\sqrt {-a^4}-2\,a^2\,b^4\,{\mathrm {e}}^{2\,x}\,\sqrt {-a^4}+a^4\,b^2\,{\mathrm {e}}^{2\,x}\,\sqrt {-a^4}\right )+b^2\,\left (a^3\,{\left (b^2\right )}^{3/2}-a^5\,\sqrt {b^2}\right )\,\left (b^6\,\sqrt {-a^4}-a\,b^5\,\sqrt {-a^4}-a^2\,b^4\,\sqrt {-a^4}+a^3\,b^3\,\sqrt {-a^4}+b^6\,{\mathrm {e}}^{2\,x}\,\sqrt {-a^4}-2\,a^2\,b^4\,{\mathrm {e}}^{2\,x}\,\sqrt {-a^4}+a^4\,b^2\,{\mathrm {e}}^{2\,x}\,\sqrt {-a^4}\right )}{-a^{12}\,b^4+3\,a^{10}\,b^6-3\,a^8\,b^8+a^6\,b^{10}}\right )\,\sqrt {b^2}}{\sqrt {-a^4}}-\frac {2}{a\,\left ({\mathrm {e}}^{2\,x}+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(2*atan((b*(a^4*(b^2)^(3/2) - a^6*(b^2)^(1/2))*(b^6*(-a^4)^(1/2) - a*b^5*(-a^4)^(1/2) - a^2*b^4*(-a^4)^(1/2) +
 a^3*b^3*(-a^4)^(1/2) + b^6*exp(2*x)*(-a^4)^(1/2) - 2*a^2*b^4*exp(2*x)*(-a^4)^(1/2) + a^4*b^2*exp(2*x)*(-a^4)^
(1/2)) + b^2*(a^3*(b^2)^(3/2) - a^5*(b^2)^(1/2))*(b^6*(-a^4)^(1/2) - a*b^5*(-a^4)^(1/2) - a^2*b^4*(-a^4)^(1/2)
 + a^3*b^3*(-a^4)^(1/2) + b^6*exp(2*x)*(-a^4)^(1/2) - 2*a^2*b^4*exp(2*x)*(-a^4)^(1/2) + a^4*b^2*exp(2*x)*(-a^4
)^(1/2)))/(a^6*b^10 - 3*a^8*b^8 + 3*a^10*b^6 - a^12*b^4))*(b^2)^(1/2))/(-a^4)^(1/2) - 2/(a*(exp(2*x) + 1))

________________________________________________________________________________________