### 3.781 $$\int \frac{1}{a+b \coth (x)+c \text{csch}(x)} \, dx$$

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.156473, antiderivative size = 113, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 12, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.417, Rules used = {3160, 3137, 3124, 618, 204} $\frac{2 a c \tanh ^{-1}\left (\frac{a+(b-c) \tanh \left (\frac{x}{2}\right )}{\sqrt{a^2-b^2+c^2}}\right )}{\left (a^2-b^2\right ) \sqrt{a^2-b^2+c^2}}-\frac{b \log (i a \sinh (x)+i b \cosh (x)+i c)}{a^2-b^2}+\frac{a x}{a^2-b^2}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 3160

Int[((a_.) + csc[(d_.) + (e_.)*(x_)]*(b_.) + cot[(d_.) + (e_.)*(x_)]*(c_.))^(-1), x_Symbol] :> Int[Sin[d + e*x
]/(b + a*Sin[d + e*x] + c*Cos[d + e*x]), x] /; FreeQ[{a, b, c, d, e}, x]

Rule 3137

Int[((A_.) + (C_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + cos[(d_.) + (e_.)*(x_)]*(b_.) + (c_.)*sin[(d_.) + (e_.)*(
x_)]), x_Symbol] :> Simp[(c*C*(d + e*x))/(e*(b^2 + c^2)), x] + (Dist[(A*(b^2 + c^2) - a*c*C)/(b^2 + c^2), Int[
1/(a + b*Cos[d + e*x] + c*Sin[d + e*x]), x], x] - Simp[(b*C*Log[a + b*Cos[d + e*x] + c*Sin[d + e*x]])/(e*(b^2
+ c^2)), x]) /; FreeQ[{a, b, c, d, e, A, C}, x] && NeQ[b^2 + c^2, 0] && NeQ[A*(b^2 + c^2) - a*c*C, 0]

Rule 3124

Int[(cos[(d_.) + (e_.)*(x_)]*(b_.) + (a_) + (c_.)*sin[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Module[{f = Free
Factors[Tan[(d + e*x)/2], x]}, Dist[(2*f)/e, Subst[Int[1/(a + b + 2*c*f*x + (a - b)*f^2*x^2), x], x, Tan[(d +
e*x)/2]/f], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[a^2 - b^2 - c^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

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

Rubi steps

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

Mathematica [A]  time = 0.197327, size = 86, normalized size = 0.76 $\frac{-\frac{2 a c \tan ^{-1}\left (\frac{a+(b-c) \tanh \left (\frac{x}{2}\right )}{\sqrt{-a^2+b^2-c^2}}\right )}{\sqrt{-a^2+b^2-c^2}}-b \log (a \sinh (x)+b \cosh (x)+c)+a x}{a^2-b^2}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(a*x - (2*a*c*ArcTan[(a + (b - c)*Tanh[x/2])/Sqrt[-a^2 + b^2 - c^2]])/Sqrt[-a^2 + b^2 - c^2] - b*Log[c + b*Cos
h[x] + a*Sinh[x]])/(a^2 - b^2)

________________________________________________________________________________________

Maple [B]  time = 0.047, size = 421, normalized size = 3.7 \begin{align*} -{\frac{{b}^{2}}{ \left ( a+b \right ) \left ( a-b \right ) \left ( b-c \right ) }\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}b- \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}c+2\,a\tanh \left ( x/2 \right ) +b+c \right ) }+{\frac{cb}{ \left ( a+b \right ) \left ( a-b \right ) \left ( b-c \right ) }\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}b- \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}c+2\,a\tanh \left ( x/2 \right ) +b+c \right ) }-2\,{\frac{ab}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{-{a}^{2}+{b}^{2}-{c}^{2}}}\arctan \left ( 1/2\,{\frac{2\, \left ( b-c \right ) \tanh \left ( x/2 \right ) +2\,a}{\sqrt{-{a}^{2}+{b}^{2}-{c}^{2}}}} \right ) }-2\,{\frac{ac}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{-{a}^{2}+{b}^{2}-{c}^{2}}}\arctan \left ( 1/2\,{\frac{2\, \left ( b-c \right ) \tanh \left ( x/2 \right ) +2\,a}{\sqrt{-{a}^{2}+{b}^{2}-{c}^{2}}}} \right ) }+2\,{\frac{a{b}^{2}}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{-{a}^{2}+{b}^{2}-{c}^{2}} \left ( b-c \right ) }\arctan \left ( 1/2\,{\frac{2\, \left ( b-c \right ) \tanh \left ( x/2 \right ) +2\,a}{\sqrt{-{a}^{2}+{b}^{2}-{c}^{2}}}} \right ) }-2\,{\frac{acb}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{-{a}^{2}+{b}^{2}-{c}^{2}} \left ( b-c \right ) }\arctan \left ( 1/2\,{\frac{2\, \left ( b-c \right ) \tanh \left ( x/2 \right ) +2\,a}{\sqrt{-{a}^{2}+{b}^{2}-{c}^{2}}}} \right ) }+4\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) +1 \right ) }{4\,a-4\,b}}-4\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) -1 \right ) }{4\,a+4\,b}} \end{align*}

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

[In]

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

[Out]

-1/(a+b)/(a-b)/(b-c)*ln(tanh(1/2*x)^2*b-tanh(1/2*x)^2*c+2*a*tanh(1/2*x)+b+c)*b^2+1/(a+b)/(a-b)/(b-c)*ln(tanh(1
/2*x)^2*b-tanh(1/2*x)^2*c+2*a*tanh(1/2*x)+b+c)*c*b-2/(a+b)/(a-b)/(-a^2+b^2-c^2)^(1/2)*arctan(1/2*(2*(b-c)*tanh
(1/2*x)+2*a)/(-a^2+b^2-c^2)^(1/2))*a*b-2/(a+b)/(a-b)/(-a^2+b^2-c^2)^(1/2)*arctan(1/2*(2*(b-c)*tanh(1/2*x)+2*a)
/(-a^2+b^2-c^2)^(1/2))*a*c+2/(a+b)/(a-b)/(-a^2+b^2-c^2)^(1/2)*arctan(1/2*(2*(b-c)*tanh(1/2*x)+2*a)/(-a^2+b^2-c
^2)^(1/2))*a/(b-c)*b^2-2/(a+b)/(a-b)/(-a^2+b^2-c^2)^(1/2)*arctan(1/2*(2*(b-c)*tanh(1/2*x)+2*a)/(-a^2+b^2-c^2)^
(1/2))*a/(b-c)*c*b+4/(4*a-4*b)*ln(tanh(1/2*x)+1)-4/(4*a+4*b)*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+b*coth(x)+c*csch(x)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 2.59453, size = 1103, normalized size = 9.76 \begin{align*} \left [-\frac{\sqrt{a^{2} - b^{2} + c^{2}} a c \log \left (\frac{2 \,{\left (a + b\right )} c \cosh \left (x\right ) +{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{2} +{\left (a^{2} + 2 \, a b + b^{2}\right )} \sinh \left (x\right )^{2} + a^{2} - b^{2} + 2 \, c^{2} + 2 \,{\left ({\left (a + b\right )} c +{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) - 2 \, \sqrt{a^{2} - b^{2} + c^{2}}{\left ({\left (a + b\right )} \cosh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right ) + c\right )}}{{\left (a + b\right )} \cosh \left (x\right )^{2} +{\left (a + b\right )} \sinh \left (x\right )^{2} + 2 \, c \cosh \left (x\right ) + 2 \,{\left ({\left (a + b\right )} \cosh \left (x\right ) + c\right )} \sinh \left (x\right ) - a + b}\right ) -{\left (a^{3} + a^{2} b - a b^{2} - b^{3} +{\left (a + b\right )} c^{2}\right )} x +{\left (a^{2} b - b^{3} + b c^{2}\right )} \log \left (\frac{2 \,{\left (b \cosh \left (x\right ) + a \sinh \left (x\right ) + c\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4} +{\left (a^{2} - b^{2}\right )} c^{2}}, -\frac{2 \, \sqrt{-a^{2} + b^{2} - c^{2}} a c \arctan \left (\frac{\sqrt{-a^{2} + b^{2} - c^{2}}{\left ({\left (a + b\right )} \cosh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right ) + c\right )}}{a^{2} - b^{2} + c^{2}}\right ) -{\left (a^{3} + a^{2} b - a b^{2} - b^{3} +{\left (a + b\right )} c^{2}\right )} x +{\left (a^{2} b - b^{3} + b c^{2}\right )} \log \left (\frac{2 \,{\left (b \cosh \left (x\right ) + a \sinh \left (x\right ) + c\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4} +{\left (a^{2} - b^{2}\right )} c^{2}}\right ] \end{align*}

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

[In]

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

[Out]

[-(sqrt(a^2 - b^2 + c^2)*a*c*log((2*(a + b)*c*cosh(x) + (a^2 + 2*a*b + b^2)*cosh(x)^2 + (a^2 + 2*a*b + b^2)*si
nh(x)^2 + a^2 - b^2 + 2*c^2 + 2*((a + b)*c + (a^2 + 2*a*b + b^2)*cosh(x))*sinh(x) - 2*sqrt(a^2 - b^2 + c^2)*((
a + b)*cosh(x) + (a + b)*sinh(x) + c))/((a + b)*cosh(x)^2 + (a + b)*sinh(x)^2 + 2*c*cosh(x) + 2*((a + b)*cosh(
x) + c)*sinh(x) - a + b)) - (a^3 + a^2*b - a*b^2 - b^3 + (a + b)*c^2)*x + (a^2*b - b^3 + b*c^2)*log(2*(b*cosh(
x) + a*sinh(x) + c)/(cosh(x) - sinh(x))))/(a^4 - 2*a^2*b^2 + b^4 + (a^2 - b^2)*c^2), -(2*sqrt(-a^2 + b^2 - c^2
)*a*c*arctan(sqrt(-a^2 + b^2 - c^2)*((a + b)*cosh(x) + (a + b)*sinh(x) + c)/(a^2 - b^2 + c^2)) - (a^3 + a^2*b
- a*b^2 - b^3 + (a + b)*c^2)*x + (a^2*b - b^3 + b*c^2)*log(2*(b*cosh(x) + a*sinh(x) + c)/(cosh(x) - sinh(x))))
/(a^4 - 2*a^2*b^2 + b^4 + (a^2 - b^2)*c^2)]

________________________________________________________________________________________

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

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

[In]

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

[Out]

Integral(1/(a + b*coth(x) + c*csch(x)), x)

________________________________________________________________________________________

Giac [A]  time = 1.17044, size = 143, normalized size = 1.27 \begin{align*} -\frac{2 \, a c \arctan \left (\frac{a e^{x} + b e^{x} + c}{\sqrt{-a^{2} + b^{2} - c^{2}}}\right )}{{\left (a^{2} - b^{2}\right )} \sqrt{-a^{2} + b^{2} - c^{2}}} - \frac{b \log \left (a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + 2 \, c e^{x} - a + b\right )}{a^{2} - b^{2}} + \frac{x}{a - b} \end{align*}

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

[In]

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

[Out]

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