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

   Optimal result
   Rubi [A] (verified)
   Mathematica [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)

Optimal result

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

[Out]

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

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {3957, 2945, 12, 2738, 211} \[ \int \frac {\text {csch}^2(x)}{a+b \text {sech}(x)} \, dx=\frac {\text {csch}(x) (b-a \cosh (x))}{a^2-b^2}+\frac {2 a b \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2}} \]

[In]

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

[Out]

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

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 211

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

Rule 2738

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[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 2945

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Simp[(g*Cos[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^(m + 1)*((b*c - a*d - (a*c -
b*d)*Sin[e + f*x])/(f*g*(a^2 - b^2)*(p + 1))), x] + Dist[1/(g^2*(a^2 - b^2)*(p + 1)), Int[(g*Cos[e + f*x])^(p
+ 2)*(a + b*Sin[e + f*x])^m*Simp[c*(a^2*(p + 2) - b^2*(m + p + 2)) + a*b*d*m + b*(a*c - b*d)*(m + p + 3)*Sin[e
 + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, g, m}, x] && NeQ[a^2 - b^2, 0] && LtQ[p, -1] && IntegerQ[2*m]

Rule 3957

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Co
s[e + f*x])^p*((b + a*Sin[e + f*x])^m/Sin[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]

Rubi steps \begin{align*} \text {integral}& = -\int \frac {\coth (x) \text {csch}(x)}{-b-a \cosh (x)} \, dx \\ & = \frac {(b-a \cosh (x)) \text {csch}(x)}{a^2-b^2}-\frac {\int \frac {a b}{-b-a \cosh (x)} \, dx}{a^2-b^2} \\ & = \frac {(b-a \cosh (x)) \text {csch}(x)}{a^2-b^2}-\frac {(a b) \int \frac {1}{-b-a \cosh (x)} \, dx}{a^2-b^2} \\ & = \frac {(b-a \cosh (x)) \text {csch}(x)}{a^2-b^2}-\frac {(2 a b) \text {Subst}\left (\int \frac {1}{-a-b-(a-b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{a^2-b^2} \\ & = \frac {2 a b \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2}}+\frac {(b-a \cosh (x)) \text {csch}(x)}{a^2-b^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.34 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.14 \[ \int \frac {\text {csch}^2(x)}{a+b \text {sech}(x)} \, dx=\frac {1}{2} \left (-\frac {4 a b \arctan \left (\frac {(-a+b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}-\frac {\coth \left (\frac {x}{2}\right )}{a+b}+\frac {\tanh \left (\frac {x}{2}\right )}{-a+b}\right ) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.39 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.17

method result size
default \(-\frac {\tanh \left (\frac {x}{2}\right )}{2 \left (a -b \right )}+\frac {2 a b \arctan \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {1}{2 \left (a +b \right ) \tanh \left (\frac {x}{2}\right )}\) \(77\)
risch \(-\frac {2 \left (-{\mathrm e}^{x} b +a \right )}{\left ({\mathrm e}^{2 x}-1\right ) \left (a^{2}-b^{2}\right )}-\frac {b a \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 )}+\frac {b a \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 )}\) \(165\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 185 vs. \(2 (58) = 116\).

Time = 0.26 (sec) , antiderivative size = 452, normalized size of antiderivative = 6.85 \[ \int \frac {\text {csch}^2(x)}{a+b \text {sech}(x)} \, dx=\left [\frac {2 \, a^{3} - 2 \, a b^{2} - {\left (a b \cosh \left (x\right )^{2} + 2 \, a b \cosh \left (x\right ) \sinh \left (x\right ) + a b \sinh \left (x\right )^{2} - a b\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {a^{2} \cosh \left (x\right )^{2} + a^{2} \sinh \left (x\right )^{2} + 2 \, a b \cosh \left (x\right ) - a^{2} + 2 \, b^{2} + 2 \, {\left (a^{2} \cosh \left (x\right ) + a b\right )} \sinh \left (x\right ) + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cosh \left (x\right ) + a \sinh \left (x\right ) + b\right )}}{a \cosh \left (x\right )^{2} + a \sinh \left (x\right )^{2} + 2 \, b \cosh \left (x\right ) + 2 \, {\left (a \cosh \left (x\right ) + b\right )} \sinh \left (x\right ) + a}\right ) - 2 \, {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{2} b - b^{3}\right )} \sinh \left (x\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )^{2}}, \frac {2 \, {\left (a^{3} - a b^{2} + {\left (a b \cosh \left (x\right )^{2} + 2 \, a b \cosh \left (x\right ) \sinh \left (x\right ) + a b \sinh \left (x\right )^{2} - a b\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cosh \left (x\right ) + a \sinh \left (x\right ) + b}{\sqrt {a^{2} - b^{2}}}\right ) - {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right ) - {\left (a^{2} b - b^{3}\right )} \sinh \left (x\right )\right )}}{a^{4} - 2 \, a^{2} b^{2} + b^{4} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )^{2}}\right ] \]

[In]

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

[Out]

[(2*a^3 - 2*a*b^2 - (a*b*cosh(x)^2 + 2*a*b*cosh(x)*sinh(x) + a*b*sinh(x)^2 - a*b)*sqrt(-a^2 + b^2)*log((a^2*co
sh(x)^2 + a^2*sinh(x)^2 + 2*a*b*cosh(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)) - 2*(a^2*
b - b^3)*cosh(x) - 2*(a^2*b - b^3)*sinh(x))/(a^4 - 2*a^2*b^2 + b^4 - (a^4 - 2*a^2*b^2 + b^4)*cosh(x)^2 - 2*(a^
4 - 2*a^2*b^2 + b^4)*cosh(x)*sinh(x) - (a^4 - 2*a^2*b^2 + b^4)*sinh(x)^2), 2*(a^3 - a*b^2 + (a*b*cosh(x)^2 + 2
*a*b*cosh(x)*sinh(x) + a*b*sinh(x)^2 - a*b)*sqrt(a^2 - b^2)*arctan(-(a*cosh(x) + a*sinh(x) + b)/sqrt(a^2 - b^2
)) - (a^2*b - b^3)*cosh(x) - (a^2*b - b^3)*sinh(x))/(a^4 - 2*a^2*b^2 + b^4 - (a^4 - 2*a^2*b^2 + b^4)*cosh(x)^2
 - 2*(a^4 - 2*a^2*b^2 + b^4)*cosh(x)*sinh(x) - (a^4 - 2*a^2*b^2 + b^4)*sinh(x)^2)]

Sympy [F]

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

[In]

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

[Out]

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

Maxima [F(-2)]

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

[In]

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

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 64, normalized size of antiderivative = 0.97 \[ \int \frac {\text {csch}^2(x)}{a+b \text {sech}(x)} \, dx=\frac {2 \, a b \arctan \left (\frac {a e^{x} + b}{\sqrt {a^{2} - b^{2}}}\right )}{{\left (a^{2} - b^{2}\right )}^{\frac {3}{2}}} + \frac {2 \, {\left (b e^{x} - a\right )}}{{\left (a^{2} - b^{2}\right )} {\left (e^{\left (2 \, x\right )} - 1\right )}} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 2.19 (sec) , antiderivative size = 151, normalized size of antiderivative = 2.29 \[ \int \frac {\text {csch}^2(x)}{a+b \text {sech}(x)} \, dx=\frac {a\,b\,\ln \left (-\frac {2\,b\,{\mathrm {e}}^x}{a^2-b^2}-\frac {2\,b\,\left (a+b\,{\mathrm {e}}^x\right )}{{\left (a+b\right )}^{3/2}\,{\left (b-a\right )}^{3/2}}\right )}{{\left (a+b\right )}^{3/2}\,{\left (b-a\right )}^{3/2}}-\frac {\frac {2\,a}{a^2-b^2}-\frac {2\,b\,{\mathrm {e}}^x}{a^2-b^2}}{{\mathrm {e}}^{2\,x}-1}-\frac {a\,b\,\ln \left (\frac {2\,b\,\left (a+b\,{\mathrm {e}}^x\right )}{{\left (a+b\right )}^{3/2}\,{\left (b-a\right )}^{3/2}}-\frac {2\,b\,{\mathrm {e}}^x}{a^2-b^2}\right )}{{\left (a+b\right )}^{3/2}\,{\left (b-a\right )}^{3/2}} \]

[In]

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

[Out]

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