Optimal. Leaf size=63 \[ -\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}+\frac {\log (\sinh (x))}{b}-\frac {a^2 \log (b \cosh (x)+a \sinh (x))}{b \left (a^2-b^2\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {3622, 3556,
3565, 3611} \begin {gather*} -\frac {a^2 \log (a \sinh (x)+b \cosh (x))}{b \left (a^2-b^2\right )}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}-\frac {a x}{b^2}+\frac {\log (\sinh (x))}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3565
Rule 3611
Rule 3622
Rubi steps
\begin {align*} \int \frac {\coth ^2(x)}{a+b \coth (x)} \, dx &=-\frac {a x}{b^2}+\frac {a^2 \int \frac {1}{a+b \coth (x)} \, dx}{b^2}+\frac {\int \coth (x) \, dx}{b}\\ &=-\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}+\frac {\log (\sinh (x))}{b}-\frac {\left (i a^2\right ) \int \frac {-i b-i a \coth (x)}{a+b \coth (x)} \, dx}{b \left (a^2-b^2\right )}\\ &=-\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}+\frac {\log (\sinh (x))}{b}-\frac {a^2 \log (b \cosh (x)+a \sinh (x))}{b \left (a^2-b^2\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.06, size = 49, normalized size = 0.78 \begin {gather*} \frac {a b x+a^2 \log (\sinh (x))-b^2 \log (\sinh (x))-a^2 \log (b \cosh (x)+a \sinh (x))}{a^2 b-b^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.29, size = 60, normalized size = 0.95
method | result | size |
derivativedivides | \(\frac {\ln \left (1+\coth \left (x \right )\right )}{2 a -2 b}-\frac {a^{2} \ln \left (a +b \coth \left (x \right )\right )}{\left (a +b \right ) \left (a -b \right ) b}-\frac {\ln \left (\coth \left (x \right )-1\right )}{2 b +2 a}\) | \(60\) |
default | \(\frac {\ln \left (1+\coth \left (x \right )\right )}{2 a -2 b}-\frac {a^{2} \ln \left (a +b \coth \left (x \right )\right )}{\left (a +b \right ) \left (a -b \right ) b}-\frac {\ln \left (\coth \left (x \right )-1\right )}{2 b +2 a}\) | \(60\) |
risch | \(\frac {x}{a +b}+\frac {2 x \,a^{2}}{b \left (a^{2}-b^{2}\right )}-\frac {2 x}{b}-\frac {a^{2} \ln \left ({\mathrm e}^{2 x}-\frac {a -b}{a +b}\right )}{b \left (a^{2}-b^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 x}-1\right )}{b}\) | \(83\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 63, normalized size = 1.00 \begin {gather*} -\frac {a^{2} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} + a + b\right )}{a^{2} b - b^{3}} + \frac {x}{a + b} + \frac {\log \left (e^{\left (-x\right )} + 1\right )}{b} + \frac {\log \left (e^{\left (-x\right )} - 1\right )}{b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.40, size = 76, normalized size = 1.21 \begin {gather*} -\frac {a^{2} \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 ) - {\left (a b + b^{2}\right )} x - {\left (a^{2} - b^{2}\right )} \log \left (\frac {2 \, \sinh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{2} b - b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 372 vs.
\(2 (51) = 102\).
time = 0.86, size = 372, normalized size = 5.90 \begin {gather*} \begin {cases} \tilde {\infty } \left (x - \log {\left (\tanh {\left (x \right )} + 1 \right )} + \log {\left (\tanh {\left (x \right )} \right )}\right ) & \text {for}\: a = 0 \wedge b = 0 \\\frac {x - \log {\left (\tanh {\left (x \right )} + 1 \right )} + \log {\left (\tanh {\left (x \right )} \right )}}{b} & \text {for}\: a = 0 \\\frac {3 x \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} - 2 b} - \frac {3 x}{2 b \tanh {\left (x \right )} - 2 b} - \frac {2 \log {\left (\tanh {\left (x \right )} + 1 \right )} \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} - 2 b} + \frac {2 \log {\left (\tanh {\left (x \right )} + 1 \right )}}{2 b \tanh {\left (x \right )} - 2 b} + \frac {2 \log {\left (\tanh {\left (x \right )} \right )} \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} - 2 b} - \frac {2 \log {\left (\tanh {\left (x \right )} \right )}}{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 {2 \log {\left (\tanh {\left (x \right )} + 1 \right )} \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} + 2 b} - \frac {2 \log {\left (\tanh {\left (x \right )} + 1 \right )}}{2 b \tanh {\left (x \right )} + 2 b} + \frac {2 \log {\left (\tanh {\left (x \right )} \right )} \tanh {\left (x \right )}}{2 b \tanh {\left (x \right )} + 2 b} + \frac {2 \log {\left (\tanh {\left (x \right )} \right )}}{2 b \tanh {\left (x \right )} + 2 b} + \frac {1}{2 b \tanh {\left (x \right )} + 2 b} & \text {for}\: a = b \\\frac {x - \frac {1}{\tanh {\left (x \right )}}}{a} & \text {for}\: b = 0 \\- \frac {a^{2} \log {\left (\tanh {\left (x \right )} + \frac {b}{a} \right )}}{a^{2} b - b^{3}} + \frac {a^{2} \log {\left (\tanh {\left (x \right )} \right )}}{a^{2} b - b^{3}} + \frac {a b x}{a^{2} b - b^{3}} - \frac {b^{2} x}{a^{2} b - b^{3}} + \frac {b^{2} \log {\left (\tanh {\left (x \right )} + 1 \right )}}{a^{2} b - b^{3}} - \frac {b^{2} \log {\left (\tanh {\left (x \right )} \right )}}{a^{2} b - b^{3}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 59, normalized size = 0.94 \begin {gather*} -\frac {a^{2} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} - a + b \right |}\right )}{a^{2} b - b^{3}} + \frac {x}{a - b} + \frac {\log \left ({\left | e^{\left (2 \, x\right )} - 1 \right |}\right )}{b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.48, size = 57, normalized size = 0.90 \begin {gather*} \frac {\ln \left ({\mathrm {e}}^{2\,x}-1\right )}{b}+\frac {x}{a-b}-\frac {a^2\,\ln \left (b-a+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a^2\,b-b^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________