3.143 \(\int \frac {\tanh (x)}{a+b \coth (x)} \, dx\)

Optimal. Leaf size=51 \[ -\frac {b x}{a^2-b^2}+\frac {b^2 \log (a \sinh (x)+b \cosh (x))}{a \left (a^2-b^2\right )}+\frac {\log (\cosh (x))}{a} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.08, antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3571, 3530, 3475} \[ -\frac {b x}{a^2-b^2}+\frac {b^2 \log (a \sinh (x)+b \cosh (x))}{a \left (a^2-b^2\right )}+\frac {\log (\cosh (x))}{a} \]

Antiderivative was successfully verified.

[In]

Int[Tanh[x]/(a + b*Coth[x]),x]

[Out]

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

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), 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]

Rule 3571

Int[1/(((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])), x_Symbol] :> Simp[((a*
c - b*d)*x)/((a^2 + b^2)*(c^2 + d^2)), x] + (Dist[b^2/((b*c - a*d)*(a^2 + b^2)), Int[(b - a*Tan[e + f*x])/(a +
 b*Tan[e + f*x]), x], x] - Dist[d^2/((b*c - a*d)*(c^2 + d^2)), Int[(d - c*Tan[e + f*x])/(c + d*Tan[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] && NeQ[c^2 + d^2, 0]

Rubi steps

\begin {align*} \int \frac {\tanh (x)}{a+b \coth (x)} \, dx &=-\frac {b x}{a^2-b^2}+\frac {\int \tanh (x) \, dx}{a}+\frac {\left (i b^2\right ) \int \frac {-i b-i a \coth (x)}{a+b \coth (x)} \, dx}{a \left (a^2-b^2\right )}\\ &=-\frac {b x}{a^2-b^2}+\frac {\log (\cosh (x))}{a}+\frac {b^2 \log (b \cosh (x)+a \sinh (x))}{a \left (a^2-b^2\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.09, size = 46, normalized size = 0.90 \[ \frac {\left (a^2-b^2\right ) \log (\cosh (x))+b (b \log (a \sinh (x)+b \cosh (x))-a x)}{a^3-a b^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Tanh[x]/(a + b*Coth[x]),x]

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.45, size = 73, normalized size = 1.43 \[ \frac {b^{2} \log \left (\frac {2 \, {\left (b \cosh \relax (x) + a \sinh \relax (x)\right )}}{\cosh \relax (x) - \sinh \relax (x)}\right ) - {\left (a^{2} + a b\right )} x + {\left (a^{2} - b^{2}\right )} \log \left (\frac {2 \, \cosh \relax (x)}{\cosh \relax (x) - \sinh \relax (x)}\right )}{a^{3} - a b^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.13, size = 57, normalized size = 1.12 \[ \frac {b^{2} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} - a + b \right |}\right )}{a^{3} - a b^{2}} - \frac {x}{a - b} + \frac {\log \left (e^{\left (2 \, x\right )} + 1\right )}{a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.12, size = 88, normalized size = 1.73 \[ \frac {b^{2} \ln \left (\left (\tanh ^{2}\left (\frac {x}{2}\right )\right ) b +2 a \tanh \left (\frac {x}{2}\right )+b \right )}{\left (a +b \right ) \left (a -b \right ) a}-\frac {8 \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{8 a +8 b}-\frac {8 \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{8 a -8 b}+\frac {\ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.42, size = 50, normalized size = 0.98 \[ \frac {b^{2} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} + a + b\right )}{a^{3} - a b^{2}} + \frac {x}{a + b} + \frac {\log \left (e^{\left (-2 \, x\right )} + 1\right )}{a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.32, size = 58, normalized size = 1.14 \[ \frac {\ln \left ({\mathrm {e}}^{2\,x}+1\right )}{a}-\frac {x}{a-b}-\frac {b^2\,\ln \left (b-a+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a\,b^2-a^3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\tanh {\relax (x )}}{a + b \coth {\relax (x )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral(tanh(x)/(a + b*coth(x)), x)

________________________________________________________________________________________