\(\int \frac {1}{a+b \coth (x)} \, dx\) [144]

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

Optimal result

Integrand size = 8, antiderivative size = 39 \[ \int \frac {1}{a+b \coth (x)} \, dx=\frac {a x}{a^2-b^2}-\frac {b \log (b \cosh (x)+a \sinh (x))}{a^2-b^2} \]

[Out]

a*x/(a^2-b^2)-b*ln(b*cosh(x)+a*sinh(x))/(a^2-b^2)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3565, 3611} \[ \int \frac {1}{a+b \coth (x)} \, dx=\frac {a x}{a^2-b^2}-\frac {b \log (a \sinh (x)+b \cosh (x))}{a^2-b^2} \]

[In]

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

[Out]

(a*x)/(a^2 - b^2) - (b*Log[b*Cosh[x] + a*Sinh[x]])/(a^2 - b^2)

Rule 3565

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

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {a x}{a^2-b^2}-\frac {(i b) \int \frac {-i b-i a \coth (x)}{a+b \coth (x)} \, dx}{a^2-b^2} \\ & = \frac {a x}{a^2-b^2}-\frac {b \log (b \cosh (x)+a \sinh (x))}{a^2-b^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.21 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.26 \[ \int \frac {1}{a+b \coth (x)} \, dx=\frac {(-a+b) \log (1-\tanh (x))+(a+b) \log (1+\tanh (x))-2 b \log (b+a \tanh (x))}{2 (a-b) (a+b)} \]

[In]

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

[Out]

((-a + b)*Log[1 - Tanh[x]] + (a + b)*Log[1 + Tanh[x]] - 2*b*Log[b + a*Tanh[x]])/(2*(a - b)*(a + b))

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.97

method result size
parallelrisch \(\frac {-b \ln \left (b +a \tanh \left (x \right )\right )+\ln \left (1-\tanh \left (x \right )\right ) b +\left (a +b \right ) x}{a^{2}-b^{2}}\) \(38\)
derivativedivides \(\frac {\ln \left (1+\coth \left (x \right )\right )}{2 a -2 b}-\frac {b \ln \left (a +b \coth \left (x \right )\right )}{\left (a -b \right ) \left (a +b \right )}-\frac {\ln \left (\coth \left (x \right )-1\right )}{2 a +2 b}\) \(55\)
default \(\frac {\ln \left (1+\coth \left (x \right )\right )}{2 a -2 b}-\frac {b \ln \left (a +b \coth \left (x \right )\right )}{\left (a -b \right ) \left (a +b \right )}-\frac {\ln \left (\coth \left (x \right )-1\right )}{2 a +2 b}\) \(55\)
risch \(\frac {x}{a +b}+\frac {2 x b}{a^{2}-b^{2}}-\frac {b \ln \left ({\mathrm e}^{2 x}-\frac {a -b}{a +b}\right )}{a^{2}-b^{2}}\) \(56\)

[In]

int(1/(a+b*coth(x)),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.08 \[ \int \frac {1}{a+b \coth (x)} \, dx=\frac {{\left (a + b\right )} x - b \log \left (\frac {2 \, {\left (b \cosh \left (x\right ) + a \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{2} - b^{2}} \]

[In]

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

[Out]

((a + b)*x - b*log(2*(b*cosh(x) + a*sinh(x))/(cosh(x) - sinh(x))))/(a^2 - b^2)

Sympy [B] (verification not implemented)

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

Time = 0.44 (sec) , antiderivative size = 148, normalized size of antiderivative = 3.79 \[ \int \frac {1}{a+b \coth (x)} \, dx=\begin {cases} \tilde {\infty } \left (x - \log {\left (\tanh {\left (x \right )} + 1 \right )}\right ) & \text {for}\: a = 0 \wedge b = 0 \\\frac {x - \log {\left (\tanh {\left (x \right )} + 1 \right )}}{b} & \text {for}\: a = 0 \\- \frac {x \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} - 2 b} + \frac {x}{2 b \tanh {\left (x \right )} - 2 b} - \frac {1}{2 b \tanh {\left (x \right )} - 2 b} & \text {for}\: a = - b \\\frac {x \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} + 2 b} + \frac {x}{2 b \tanh {\left (x \right )} + 2 b} + \frac {1}{2 b \tanh {\left (x \right )} + 2 b} & \text {for}\: a = b \\\frac {a x}{a^{2} - b^{2}} - \frac {b x}{a^{2} - b^{2}} + \frac {b \log {\left (\tanh {\left (x \right )} + 1 \right )}}{a^{2} - b^{2}} - \frac {b \log {\left (\tanh {\left (x \right )} + \frac {b}{a} \right )}}{a^{2} - b^{2}} & \text {otherwise} \end {cases} \]

[In]

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

[Out]

Piecewise((zoo*(x - log(tanh(x) + 1)), Eq(a, 0) & Eq(b, 0)), ((x - log(tanh(x) + 1))/b, Eq(a, 0)), (-x*tanh(x)
/(2*b*tanh(x) - 2*b) + x/(2*b*tanh(x) - 2*b) - 1/(2*b*tanh(x) - 2*b), Eq(a, -b)), (x*tanh(x)/(2*b*tanh(x) + 2*
b) + x/(2*b*tanh(x) + 2*b) + 1/(2*b*tanh(x) + 2*b), Eq(a, b)), (a*x/(a**2 - b**2) - b*x/(a**2 - b**2) + b*log(
tanh(x) + 1)/(a**2 - b**2) - b*log(tanh(x) + b/a)/(a**2 - b**2), True))

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 37, normalized size of antiderivative = 0.95 \[ \int \frac {1}{a+b \coth (x)} \, dx=-\frac {b \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} + a + b\right )}{a^{2} - b^{2}} + \frac {x}{a + b} \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.10 \[ \int \frac {1}{a+b \coth (x)} \, dx=-\frac {b \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} - a + b \right |}\right )}{a^{2} - b^{2}} + \frac {x}{a - b} \]

[In]

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

[Out]

-b*log(abs(a*e^(2*x) + b*e^(2*x) - a + b))/(a^2 - b^2) + x/(a - b)

Mupad [B] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.08 \[ \int \frac {1}{a+b \coth (x)} \, dx=\frac {x}{a-b}-\frac {b\,\ln \left (b-a+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a^2-b^2} \]

[In]

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

[Out]

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