### 3.650 $$\int \frac{1}{(a \coth (x)+b \text{csch}(x))^2} \, dx$$

Optimal. Leaf size=67 $-\frac{2 b \tan ^{-1}\left (\frac{\sqrt{a-b} \tanh \left (\frac{x}{2}\right )}{\sqrt{a+b}}\right )}{a^2 \sqrt{a-b} \sqrt{a+b}}+\frac{x}{a^2}-\frac{\sinh (x)}{a (a \cosh (x)+b)}$

[Out]

x/a^2 - (2*b*ArcTan[(Sqrt[a - b]*Tanh[x/2])/Sqrt[a + b]])/(a^2*Sqrt[a - b]*Sqrt[a + b]) - Sinh[x]/(a*(b + a*Co
sh[x]))

________________________________________________________________________________________

Rubi [A]  time = 0.131912, antiderivative size = 67, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 11, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.454, Rules used = {4392, 2693, 2735, 2659, 205} $-\frac{2 b \tan ^{-1}\left (\frac{\sqrt{a-b} \tanh \left (\frac{x}{2}\right )}{\sqrt{a+b}}\right )}{a^2 \sqrt{a-b} \sqrt{a+b}}+\frac{x}{a^2}-\frac{\sinh (x)}{a (a \cosh (x)+b)}$

Antiderivative was successfully veriﬁed.

[In]

Int[(a*Coth[x] + b*Csch[x])^(-2),x]

[Out]

x/a^2 - (2*b*ArcTan[(Sqrt[a - b]*Tanh[x/2])/Sqrt[a + b]])/(a^2*Sqrt[a - b]*Sqrt[a + b]) - Sinh[x]/(a*(b + a*Co
sh[x]))

Rule 4392

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rule 2693

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

Rule 2735

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*x)/d
, x] - Dist[(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 2659

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 205

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

Rubi steps

\begin{align*} \int \frac{1}{(a \coth (x)+b \text{csch}(x))^2} \, dx &=-\int \frac{\sinh ^2(x)}{(i b+i a \cosh (x))^2} \, dx\\ &=-\frac{\sinh (x)}{a (b+a \cosh (x))}+\frac{i \int \frac{\cosh (x)}{i b+i a \cosh (x)} \, dx}{a}\\ &=\frac{x}{a^2}-\frac{\sinh (x)}{a (b+a \cosh (x))}-\frac{(i b) \int \frac{1}{i b+i a \cosh (x)} \, dx}{a^2}\\ &=\frac{x}{a^2}-\frac{\sinh (x)}{a (b+a \cosh (x))}-\frac{(2 i b) \operatorname{Subst}\left (\int \frac{1}{i a+i b-(-i a+i b) x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{a^2}\\ &=\frac{x}{a^2}-\frac{2 b \tan ^{-1}\left (\frac{\sqrt{a-b} \tanh \left (\frac{x}{2}\right )}{\sqrt{a+b}}\right )}{a^2 \sqrt{a-b} \sqrt{a+b}}-\frac{\sinh (x)}{a (b+a \cosh (x))}\\ \end{align*}

Mathematica [A]  time = 0.333363, size = 61, normalized size = 0.91 $\frac{\frac{2 b \tan ^{-1}\left (\frac{(b-a) \tanh \left (\frac{x}{2}\right )}{\sqrt{a^2-b^2}}\right )}{\sqrt{a^2-b^2}}-\frac{a \sinh (x)}{a \cosh (x)+b}+x}{a^2}$

Antiderivative was successfully veriﬁed.

[In]

Integrate[(a*Coth[x] + b*Csch[x])^(-2),x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.05, size = 95, normalized size = 1.4 \begin{align*}{\frac{1}{{a}^{2}}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) }-2\,{\frac{\tanh \left ( x/2 \right ) }{a \left ( a \left ( \tanh \left ( x/2 \right ) \right ) ^{2}- \left ( \tanh \left ( x/2 \right ) \right ) ^{2}b+a+b \right ) }}-2\,{\frac{b}{{a}^{2}\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}\arctan \left ({\frac{ \left ( a-b \right ) \tanh \left ( x/2 \right ) }{\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}} \right ) }-{\frac{1}{{a}^{2}}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) } \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.19164, size = 1647, normalized size = 24.58 \begin{align*} \text{result too large to display} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral((a*coth(x) + b*csch(x))**(-2), x)

________________________________________________________________________________________

Giac [A]  time = 1.17056, size = 92, normalized size = 1.37 \begin{align*} -\frac{2 \, b \arctan \left (\frac{a e^{x} + b}{\sqrt{a^{2} - b^{2}}}\right )}{\sqrt{a^{2} - b^{2}} a^{2}} + \frac{x}{a^{2}} + \frac{2 \,{\left (b e^{x} + a\right )}}{{\left (a e^{\left (2 \, x\right )} + 2 \, b e^{x} + a\right )} a^{2}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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