3.2.18 \(\int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx\) [118]

3.2.18.1 Optimal result
3.2.18.2 Mathematica [A] (verified)
3.2.18.3 Rubi [C] (verified)
3.2.18.4 Maple [A] (verified)
3.2.18.5 Fricas [A] (verification not implemented)
3.2.18.6 Sympy [F]
3.2.18.7 Maxima [F(-2)]
3.2.18.8 Giac [A] (verification not implemented)
3.2.18.9 Mupad [B] (verification not implemented)

3.2.18.1 Optimal result

Integrand size = 11, antiderivative size = 50 \[ \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx=\frac {\arctan (\sinh (x))}{a}+\frac {b \text {arctanh}\left (\frac {a \cosh (x)+b \sinh (x)}{\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2}} \]

output
arctan(sinh(x))/a+b*arctanh((a*cosh(x)+b*sinh(x))/(a^2-b^2)^(1/2))/a/(a^2- 
b^2)^(1/2)
 
3.2.18.2 Mathematica [A] (verified)

Time = 0.24 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.20 \[ \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx=\frac {2 \left (\arctan \left (\tanh \left (\frac {x}{2}\right )\right )-\frac {b \arctan \left (\frac {a+b \tanh \left (\frac {x}{2}\right )}{\sqrt {-a+b} \sqrt {a+b}}\right )}{\sqrt {-a+b} \sqrt {a+b}}\right )}{a} \]

input
Integrate[Sech[x]/(a + b*Coth[x]),x]
 
output
(2*(ArcTan[Tanh[x/2]] - (b*ArcTan[(a + b*Tanh[x/2])/(Sqrt[-a + b]*Sqrt[a + 
 b])])/(Sqrt[-a + b]*Sqrt[a + b])))/a
 
3.2.18.3 Rubi [C] (verified)

Result contains complex when optimal does not.

Time = 0.38 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.20, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.727, Rules used = {3042, 4001, 26, 26, 3042, 26, 3589, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\sin \left (\frac {\pi }{2}+i x\right ) \left (a-i b \tan \left (\frac {\pi }{2}+i x\right )\right )}dx\)

\(\Big \downarrow \) 4001

\(\displaystyle \int -\frac {i \tanh (x)}{-i a \sinh (x)-i b \cosh (x)}dx\)

\(\Big \downarrow \) 26

\(\displaystyle -i \int \frac {i \tanh (x)}{b \cosh (x)+a \sinh (x)}dx\)

\(\Big \downarrow \) 26

\(\displaystyle \int \frac {\tanh (x)}{a \sinh (x)+b \cosh (x)}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int -\frac {i \sin (i x)}{\cos (i x) (b \cos (i x)-i a \sin (i x))}dx\)

\(\Big \downarrow \) 26

\(\displaystyle -i \int \frac {\sin (i x)}{\cos (i x) (b \cos (i x)-i a \sin (i x))}dx\)

\(\Big \downarrow \) 3589

\(\displaystyle -i \int \left (\frac {i \text {sech}(x)}{a}-\frac {i b}{a (b \cosh (x)+a \sinh (x))}\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle -i \left (\frac {i b \text {arctanh}\left (\frac {a \cosh (x)+b \sinh (x)}{\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2}}+\frac {i \arctan (\sinh (x))}{a}\right )\)

input
Int[Sech[x]/(a + b*Coth[x]),x]
 
output
(-I)*((I*ArcTan[Sinh[x]])/a + (I*b*ArcTanh[(a*Cosh[x] + b*Sinh[x])/Sqrt[a^ 
2 - b^2]])/(a*Sqrt[a^2 - b^2]))
 

3.2.18.3.1 Defintions of rubi rules used

rule 26
Int[(Complex[0, a_])*(Fx_), x_Symbol] :> Simp[(Complex[Identity[0], a])   I 
nt[Fx, x], x] /; FreeQ[a, x] && EqQ[a^2, 1]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3589
Int[(cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.))/(cos[(c_. 
) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)]), x_Symbol] :> Int[Ex 
pandTrig[cos[c + d*x]^m*(sin[c + d*x]^n/(a*cos[c + d*x] + b*sin[c + d*x])), 
 x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IntegersQ[m, n]
 

rule 4001
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/C 
os[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]))
 
3.2.18.4 Maple [A] (verified)

Time = 0.44 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.08

method result size
default \(-\frac {2 b \arctan \left (\frac {2 b \tanh \left (\frac {x}{2}\right )+2 a}{2 \sqrt {-a^{2}+b^{2}}}\right )}{a \sqrt {-a^{2}+b^{2}}}+\frac {2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{a}\) \(54\)
risch \(\frac {b \ln \left ({\mathrm e}^{x}+\frac {a -b}{\sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, a}-\frac {b \ln \left ({\mathrm e}^{x}-\frac {a -b}{\sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, a}+\frac {i \ln \left ({\mathrm e}^{x}+i\right )}{a}-\frac {i \ln \left ({\mathrm e}^{x}-i\right )}{a}\) \(102\)

input
int(sech(x)/(a+b*coth(x)),x,method=_RETURNVERBOSE)
 
output
-2*b/a/(-a^2+b^2)^(1/2)*arctan(1/2*(2*b*tanh(1/2*x)+2*a)/(-a^2+b^2)^(1/2)) 
+2/a*arctan(tanh(1/2*x))
 
3.2.18.5 Fricas [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 200, normalized size of antiderivative = 4.00 \[ \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx=\left [\frac {\sqrt {a^{2} - b^{2}} b \log \left (\frac {{\left (a + b\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (a + b\right )} \sinh \left (x\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )} + a - b}{{\left (a + b\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (a + b\right )} \sinh \left (x\right )^{2} - a + b}\right ) + 2 \, {\left (a^{2} - b^{2}\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}{a^{3} - a b^{2}}, -\frac {2 \, {\left (\sqrt {-a^{2} + b^{2}} b \arctan \left (\frac {\sqrt {-a^{2} + b^{2}}}{{\left (a + b\right )} \cosh \left (x\right ) + {\left (a + b\right )} \sinh \left (x\right )}\right ) - {\left (a^{2} - b^{2}\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )\right )}}{a^{3} - a b^{2}}\right ] \]

input
integrate(sech(x)/(a+b*coth(x)),x, algorithm="fricas")
 
output
[(sqrt(a^2 - b^2)*b*log(((a + b)*cosh(x)^2 + 2*(a + b)*cosh(x)*sinh(x) + ( 
a + b)*sinh(x)^2 + 2*sqrt(a^2 - b^2)*(cosh(x) + sinh(x)) + a - b)/((a + b) 
*cosh(x)^2 + 2*(a + b)*cosh(x)*sinh(x) + (a + b)*sinh(x)^2 - a + b)) + 2*( 
a^2 - b^2)*arctan(cosh(x) + sinh(x)))/(a^3 - a*b^2), -2*(sqrt(-a^2 + b^2)* 
b*arctan(sqrt(-a^2 + b^2)/((a + b)*cosh(x) + (a + b)*sinh(x))) - (a^2 - b^ 
2)*arctan(cosh(x) + sinh(x)))/(a^3 - a*b^2)]
 
3.2.18.6 Sympy [F]

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

input
integrate(sech(x)/(a+b*coth(x)),x)
 
output
Integral(sech(x)/(a + b*coth(x)), x)
 
3.2.18.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx=\text {Exception raised: ValueError} \]

input
integrate(sech(x)/(a+b*coth(x)),x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f 
or more de
 
3.2.18.8 Giac [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.96 \[ \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx=-\frac {2 \, b \arctan \left (\frac {a e^{x} + b e^{x}}{\sqrt {-a^{2} + b^{2}}}\right )}{\sqrt {-a^{2} + b^{2}} a} + \frac {2 \, \arctan \left (e^{x}\right )}{a} \]

input
integrate(sech(x)/(a+b*coth(x)),x, algorithm="giac")
 
output
-2*b*arctan((a*e^x + b*e^x)/sqrt(-a^2 + b^2))/(sqrt(-a^2 + b^2)*a) + 2*arc 
tan(e^x)/a
 
3.2.18.9 Mupad [B] (verification not implemented)

Time = 4.15 (sec) , antiderivative size = 164, normalized size of antiderivative = 3.28 \[ \int \frac {\text {sech}(x)}{a+b \coth (x)} \, dx=\frac {b\,\ln \left (32\,a\,b^2\,{\mathrm {e}}^x+32\,a^2\,b\,{\mathrm {e}}^x+32\,a\,b\,\sqrt {a^2-b^2}\right )}{a\,\sqrt {a^2-b^2}}-\frac {b\,\ln \left (32\,a\,b^2\,{\mathrm {e}}^x+32\,a^2\,b\,{\mathrm {e}}^x-32\,a\,b\,\sqrt {a^2-b^2}\right )}{a\,\sqrt {a^2-b^2}}+\frac {\ln \left (32\,a\,b\,{\mathrm {e}}^x-32\,a^2\,{\mathrm {e}}^x+a\,b\,32{}\mathrm {i}-a^2\,32{}\mathrm {i}\right )\,1{}\mathrm {i}}{a}-\frac {\ln \left (32\,a^2\,{\mathrm {e}}^x-32\,a\,b\,{\mathrm {e}}^x+a\,b\,32{}\mathrm {i}-a^2\,32{}\mathrm {i}\right )\,1{}\mathrm {i}}{a} \]

input
int(1/(cosh(x)*(a + b*coth(x))),x)
 
output
(log(a*b*32i - a^2*32i - 32*a^2*exp(x) + 32*a*b*exp(x))*1i)/a - (log(a*b*3 
2i - a^2*32i + 32*a^2*exp(x) - 32*a*b*exp(x))*1i)/a - (b*log(32*a*b^2*exp( 
x) + 32*a^2*b*exp(x) - 32*a*b*(a^2 - b^2)^(1/2)))/(a*(a^2 - b^2)^(1/2)) + 
(b*log(32*a*b^2*exp(x) + 32*a^2*b*exp(x) + 32*a*b*(a^2 - b^2)^(1/2)))/(a*( 
a^2 - b^2)^(1/2))