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

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

Optimal result

Integrand size = 13, antiderivative size = 114 \[ \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {a x}{a^2-b^2}-\frac {b^2 x}{a \left (a^2-b^2\right )}+\frac {2 b^3 \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a (a-b)^{3/2} (a+b)^{3/2}}-\frac {a \coth (x)}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2} \] Output:

a*x/(a^2-b^2)-b^2*x/a/(a^2-b^2)+2*b^3*arctan((a-b)^(1/2)*tanh(1/2*x)/(a+b) 
^(1/2))/a/(a-b)^(3/2)/(a+b)^(3/2)-a*coth(x)/(a^2-b^2)+b*csch(x)/(a^2-b^2)
 

Mathematica [A] (verified)

Time = 0.33 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.71 \[ \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {a^2 x-b^2 x+\frac {2 b^3 \arctan \left (\frac {(a-b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}-a^2 \coth (x)+a b \text {csch}(x)}{a^3-a b^2} \] Input:

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

Output:

(a^2*x - b^2*x + (2*b^3*ArcTan[((a - b)*Tanh[x/2])/Sqrt[a^2 - b^2]])/Sqrt[ 
a^2 - b^2] - a^2*Coth[x] + a*b*Csch[x])/(a^3 - a*b^2)
 

Rubi [A] (verified)

Time = 0.75 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.91, number of steps used = 18, number of rules used = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.308, Rules used = {3042, 25, 4386, 25, 3042, 3381, 25, 3042, 25, 3086, 24, 3214, 3042, 3138, 218, 3954, 24}

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 {\coth ^2(x)}{a+b \text {sech}(x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 4386

\(\displaystyle -\int -\frac {\cosh (x) \coth ^2(x)}{b+a \cosh (x)}dx\)

\(\Big \downarrow \) 25

\(\displaystyle \int \frac {\cosh (x) \coth ^2(x)}{a \cosh (x)+b}dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3381

\(\displaystyle \frac {b^2 \int -\frac {\cosh (x)}{b+a \cosh (x)}dx}{a^2-b^2}-\frac {a \int -\coth ^2(x)dx}{a^2-b^2}-\frac {b \int \coth (x) \text {csch}(x)dx}{a^2-b^2}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {b^2 \int \frac {\cosh (x)}{b+a \cosh (x)}dx}{a^2-b^2}+\frac {a \int \coth ^2(x)dx}{a^2-b^2}-\frac {b \int \coth (x) \text {csch}(x)dx}{a^2-b^2}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3086

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3138

\(\displaystyle -\frac {a \int \tan \left (i x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}-\frac {b^2 \left (\frac {x}{a}-\frac {2 b \int \frac {1}{(a-b) \tanh ^2\left (\frac {x}{2}\right )+a+b}d\tanh \left (\frac {x}{2}\right )}{a}\right )}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}\)

\(\Big \downarrow \) 218

\(\displaystyle -\frac {a \int \tan \left (i x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}-\frac {b^2 \left (\frac {x}{a}-\frac {2 b \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b}}\right )}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}\)

\(\Big \downarrow \) 3954

\(\displaystyle -\frac {a (\coth (x)-\int 1dx)}{a^2-b^2}-\frac {b^2 \left (\frac {x}{a}-\frac {2 b \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b}}\right )}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}\)

\(\Big \downarrow \) 24

\(\displaystyle -\frac {b^2 \left (\frac {x}{a}-\frac {2 b \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b}}\right )}{a^2-b^2}-\frac {a (\coth (x)-x)}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}\)

Input:

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

Output:

-((b^2*(x/a - (2*b*ArcTan[(Sqrt[a - b]*Tanh[x/2])/Sqrt[a + b]])/(a*Sqrt[a 
- b]*Sqrt[a + b])))/(a^2 - b^2)) - (a*(-x + Coth[x]))/(a^2 - b^2) + (b*Csc 
h[x])/(a^2 - b^2)
 

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

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

rule 3086
Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^( 
n_.), x_Symbol] :> Simp[a/f   Subst[Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2 
), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2 
] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])
 

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3381
Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^( 
n_))/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[a*(d^2/(a^2 
- b^2))   Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n - 2), x], x] + (-Simp[ 
b*(d/(a^2 - b^2))   Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n - 1), x], x] 
 - Simp[a^2*(d^2/(g^2*(a^2 - b^2)))   Int[(g*Cos[e + f*x])^(p + 2)*((d*Sin[ 
e + f*x])^(n - 2)/(a + b*Sin[e + f*x])), x], x]) /; FreeQ[{a, b, d, e, f, g 
}, x] && NeQ[a^2 - b^2, 0] && IntegersQ[2*n, 2*p] && LtQ[p, -1] && GtQ[n, 1 
]
 

rule 3954
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d 
*x])^(n - 1)/(d*(n - 1))), x] - Simp[b^2   Int[(b*Tan[c + d*x])^(n - 2), x] 
, x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]
 

rule 4386
Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n 
_), x_Symbol] :> Int[Cos[c + d*x]^m*((b + a*Sin[c + d*x])^n/Sin[c + d*x]^(m 
 + n)), x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0] && IntegerQ[n] && 
 IntegerQ[m] && (IntegerQ[m/2] || LeQ[m, 1])
 
Maple [A] (verified)

Time = 0.41 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.91

method result size
default \(-\frac {\tanh \left (\frac {x}{2}\right )}{2 \left (a -b \right )}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{a}-\frac {1}{2 \left (a +b \right ) \tanh \left (\frac {x}{2}\right )}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{a}+\frac {2 b^{3} \arctan \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\) \(104\)
risch \(\frac {x}{a}-\frac {2 \left (-b \,{\mathrm e}^{x}+a \right )}{\left ({\mathrm e}^{2 x}-1\right ) \left (a^{2}-b^{2}\right )}-\frac {b^{3} \ln \left ({\mathrm e}^{x}+\frac {b \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, a}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) a}+\frac {b^{3} \ln \left ({\mathrm e}^{x}+\frac {b \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, a}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) a}\) \(178\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 283 vs. \(2 (104) = 208\).

Time = 0.10 (sec) , antiderivative size = 646, normalized size of antiderivative = 5.67 \[ \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx =\text {Too large to display} \] Input:

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

Output:

[(2*a^4 - 2*a^2*b^2 - (a^4 - 2*a^2*b^2 + b^4)*x*cosh(x)^2 - (a^4 - 2*a^2*b 
^2 + b^4)*x*sinh(x)^2 - (b^3*cosh(x)^2 + 2*b^3*cosh(x)*sinh(x) + b^3*sinh( 
x)^2 - b^3)*sqrt(-a^2 + b^2)*log((a^2*cosh(x)^2 + a^2*sinh(x)^2 + 2*a*b*co 
sh(x) - a^2 + 2*b^2 + 2*(a^2*cosh(x) + a*b)*sinh(x) + 2*sqrt(-a^2 + b^2)*( 
a*cosh(x) + a*sinh(x) + b))/(a*cosh(x)^2 + a*sinh(x)^2 + 2*b*cosh(x) + 2*( 
a*cosh(x) + b)*sinh(x) + a)) + (a^4 - 2*a^2*b^2 + b^4)*x - 2*(a^3*b - a*b^ 
3)*cosh(x) - 2*(a^3*b - a*b^3 + (a^4 - 2*a^2*b^2 + b^4)*x*cosh(x))*sinh(x) 
)/(a^5 - 2*a^3*b^2 + a*b^4 - (a^5 - 2*a^3*b^2 + a*b^4)*cosh(x)^2 - 2*(a^5 
- 2*a^3*b^2 + a*b^4)*cosh(x)*sinh(x) - (a^5 - 2*a^3*b^2 + a*b^4)*sinh(x)^2 
), (2*a^4 - 2*a^2*b^2 - (a^4 - 2*a^2*b^2 + b^4)*x*cosh(x)^2 - (a^4 - 2*a^2 
*b^2 + b^4)*x*sinh(x)^2 + 2*(b^3*cosh(x)^2 + 2*b^3*cosh(x)*sinh(x) + b^3*s 
inh(x)^2 - b^3)*sqrt(a^2 - b^2)*arctan(-(a*cosh(x) + a*sinh(x) + b)/sqrt(a 
^2 - b^2)) + (a^4 - 2*a^2*b^2 + b^4)*x - 2*(a^3*b - a*b^3)*cosh(x) - 2*(a^ 
3*b - a*b^3 + (a^4 - 2*a^2*b^2 + b^4)*x*cosh(x))*sinh(x))/(a^5 - 2*a^3*b^2 
 + a*b^4 - (a^5 - 2*a^3*b^2 + a*b^4)*cosh(x)^2 - 2*(a^5 - 2*a^3*b^2 + a*b^ 
4)*cosh(x)*sinh(x) - (a^5 - 2*a^3*b^2 + a*b^4)*sinh(x)^2)]
 

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

integrate(coth(x)^2/(a+b*sech(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*b^2-4*a^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.72 \[ \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {2 \, b^{3} \arctan \left (\frac {a e^{x} + b}{\sqrt {a^{2} - b^{2}}}\right )}{{\left (a^{3} - a b^{2}\right )} \sqrt {a^{2} - b^{2}}} + \frac {x}{a} + \frac {2 \, {\left (b e^{x} - a\right )}}{{\left (a^{2} - b^{2}\right )} {\left (e^{\left (2 \, x\right )} - 1\right )}} \] Input:

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

Output:

2*b^3*arctan((a*e^x + b)/sqrt(a^2 - b^2))/((a^3 - a*b^2)*sqrt(a^2 - b^2)) 
+ x/a + 2*(b*e^x - a)/((a^2 - b^2)*(e^(2*x) - 1))
 

Mupad [B] (verification not implemented)

Time = 2.54 (sec) , antiderivative size = 383, normalized size of antiderivative = 3.36 \[ \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {x}{a}-\frac {\frac {2\,a}{a^2-b^2}-\frac {2\,b\,{\mathrm {e}}^x}{a^2-b^2}}{{\mathrm {e}}^{2\,x}-1}-\frac {2\,\mathrm {atan}\left (\left ({\mathrm {e}}^x\,\left (\frac {2\,b^3}{a^3\,\left (a\,b^2-a^3\right )\,\left (a^2-b^2\right )\,\sqrt {b^6}}-\frac {2\,\left (a\,b^3\,\sqrt {b^6}-a^3\,b\,\sqrt {b^6}\right )}{a^2\,b^2\,\left (a\,b^2-a^3\right )\,\sqrt {a^2\,{\left (a^2-b^2\right )}^3}\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}\right )+\frac {2\,\left (a^4\,\sqrt {b^6}-a^2\,b^2\,\sqrt {b^6}\right )}{a^2\,b^2\,\left (a\,b^2-a^3\right )\,\sqrt {a^2\,{\left (a^2-b^2\right )}^3}\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}\right )\,\left (\frac {a^4\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}{2}-\frac {a^2\,b^2\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}{2}\right )\right )\,\sqrt {b^6}}{\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}} \] Input:

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

Output:

x/a - ((2*a)/(a^2 - b^2) - (2*b*exp(x))/(a^2 - b^2))/(exp(2*x) - 1) - (2*a 
tan((exp(x)*((2*b^3)/(a^3*(a*b^2 - a^3)*(a^2 - b^2)*(b^6)^(1/2)) - (2*(a*b 
^3*(b^6)^(1/2) - a^3*b*(b^6)^(1/2)))/(a^2*b^2*(a*b^2 - a^3)*(a^2*(a^2 - b^ 
2)^3)^(1/2)*(a^8 - a^2*b^6 + 3*a^4*b^4 - 3*a^6*b^2)^(1/2))) + (2*(a^4*(b^6 
)^(1/2) - a^2*b^2*(b^6)^(1/2)))/(a^2*b^2*(a*b^2 - a^3)*(a^2*(a^2 - b^2)^3) 
^(1/2)*(a^8 - a^2*b^6 + 3*a^4*b^4 - 3*a^6*b^2)^(1/2)))*((a^4*(a^8 - a^2*b^ 
6 + 3*a^4*b^4 - 3*a^6*b^2)^(1/2))/2 - (a^2*b^2*(a^8 - a^2*b^6 + 3*a^4*b^4 
- 3*a^6*b^2)^(1/2))/2))*(b^6)^(1/2))/(a^8 - a^2*b^6 + 3*a^4*b^4 - 3*a^6*b^ 
2)^(1/2)
 

Reduce [B] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 230, normalized size of antiderivative = 2.02 \[ \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {2 e^{2 x} \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) b^{3}-2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) b^{3}+e^{2 x} a^{4} x -2 e^{2 x} a^{4}-2 e^{2 x} a^{2} b^{2} x +2 e^{2 x} a^{2} b^{2}+e^{2 x} b^{4} x +2 e^{x} a^{3} b -2 e^{x} a \,b^{3}-a^{4} x +2 a^{2} b^{2} x -b^{4} x}{a \left (e^{2 x} a^{4}-2 e^{2 x} a^{2} b^{2}+e^{2 x} b^{4}-a^{4}+2 a^{2} b^{2}-b^{4}\right )} \] Input:

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

Output:

(2*e**(2*x)*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b**2))*b**3 - 
2*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b**2))*b**3 + e**(2*x)*a 
**4*x - 2*e**(2*x)*a**4 - 2*e**(2*x)*a**2*b**2*x + 2*e**(2*x)*a**2*b**2 + 
e**(2*x)*b**4*x + 2*e**x*a**3*b - 2*e**x*a*b**3 - a**4*x + 2*a**2*b**2*x - 
 b**4*x)/(a*(e**(2*x)*a**4 - 2*e**(2*x)*a**2*b**2 + e**(2*x)*b**4 - a**4 + 
 2*a**2*b**2 - b**4))