Optimal. Leaf size=60 \[ \frac {a x}{a^2-b^2}-\frac {\coth (x)}{a}-\frac {b \log (\sinh (x))}{a^2}-\frac {b^3 \log (a \cosh (x)+b \sinh (x))}{a^2 \left (a^2-b^2\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 60, 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 = {3650, 3732,
3611, 3556} \begin {gather*} \frac {a x}{a^2-b^2}-\frac {b^3 \log (a \cosh (x)+b \sinh (x))}{a^2 \left (a^2-b^2\right )}-\frac {b \log (\sinh (x))}{a^2}-\frac {\coth (x)}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3611
Rule 3650
Rule 3732
Rubi steps
\begin {align*} \int \frac {\coth ^2(x)}{a+b \tanh (x)} \, dx &=-\frac {\coth (x)}{a}-\frac {i \int \frac {\coth (x) \left (-i b+i a \tanh (x)+i b \tanh ^2(x)\right )}{a+b \tanh (x)} \, dx}{a}\\ &=\frac {a x}{a^2-b^2}-\frac {\coth (x)}{a}-\frac {b \int \coth (x) \, dx}{a^2}-\frac {\left (i b^3\right ) \int \frac {-i b-i a \tanh (x)}{a+b \tanh (x)} \, dx}{a^2 \left (a^2-b^2\right )}\\ &=\frac {a x}{a^2-b^2}-\frac {\coth (x)}{a}-\frac {b \log (\sinh (x))}{a^2}-\frac {b^3 \log (a \cosh (x)+b \sinh (x))}{a^2 \left (a^2-b^2\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 64, normalized size = 1.07 \begin {gather*} \frac {a^3 x+\left (-a^3+a b^2\right ) \coth (x)+\left (-a^2 b+b^3\right ) \log (\sinh (x))-b^3 \log (a \cosh (x)+b \sinh (x))}{a^4-a^2 b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.66, size = 100, normalized size = 1.67
method | result | size |
risch | \(\frac {x}{a +b}+\frac {2 b x}{a^{2}}+\frac {2 x \,b^{3}}{a^{2} \left (a^{2}-b^{2}\right )}-\frac {2}{a \left ({\mathrm e}^{2 x}-1\right )}-\frac {b \ln \left ({\mathrm e}^{2 x}-1\right )}{a^{2}}-\frac {b^{3} \ln \left ({\mathrm e}^{2 x}+\frac {a -b}{a +b}\right )}{a^{2} \left (a^{2}-b^{2}\right )}\) | \(98\) |
default | \(-\frac {\tanh \left (\frac {x}{2}\right )}{2 a}-\frac {1}{2 a \tanh \left (\frac {x}{2}\right )}-\frac {b \ln \left (\tanh \left (\frac {x}{2}\right )\right )}{a^{2}}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{a +b}-\frac {b^{3} \ln \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+2 b \tanh \left (\frac {x}{2}\right )+a \right )}{a^{2} \left (a +b \right ) \left (a -b \right )}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{a -b}\) | \(100\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 86, normalized size = 1.43 \begin {gather*} -\frac {b^{3} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{4} - a^{2} b^{2}} + \frac {x}{a + b} - \frac {b \log \left (e^{\left (-x\right )} + 1\right )}{a^{2}} - \frac {b \log \left (e^{\left (-x\right )} - 1\right )}{a^{2}} + \frac {2}{a e^{\left (-2 \, x\right )} - a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 271 vs.
\(2 (60) = 120\).
time = 0.42, size = 271, normalized size = 4.52 \begin {gather*} -\frac {{\left (a^{3} + a^{2} b\right )} x \cosh \left (x\right )^{2} + 2 \, {\left (a^{3} + a^{2} b\right )} x \cosh \left (x\right ) \sinh \left (x\right ) + {\left (a^{3} + a^{2} b\right )} x \sinh \left (x\right )^{2} - 2 \, a^{3} + 2 \, a b^{2} - {\left (a^{3} + a^{2} b\right )} x - {\left (b^{3} \cosh \left (x\right )^{2} + 2 \, b^{3} \cosh \left (x\right ) \sinh \left (x\right ) + b^{3} \sinh \left (x\right )^{2} - b^{3}\right )} \log \left (\frac {2 \, {\left (a \cosh \left (x\right ) + b \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + {\left (a^{2} b - b^{3} - {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{2} b - b^{3}\right )} \sinh \left (x\right )^{2}\right )} \log \left (\frac {2 \, \sinh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{4} - a^{2} b^{2} - {\left (a^{4} - a^{2} b^{2}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{4} - a^{2} b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{4} - a^{2} b^{2}\right )} \sinh \left (x\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\coth ^{2}{\left (x \right )}}{a + b \tanh {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 75, normalized size = 1.25 \begin {gather*} -\frac {b^{3} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{4} - a^{2} b^{2}} + \frac {x}{a - b} - \frac {b \log \left ({\left | e^{\left (2 \, x\right )} - 1 \right |}\right )}{a^{2}} - \frac {2}{a {\left (e^{\left (2 \, x\right )} - 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.35, size = 73, normalized size = 1.22 \begin {gather*} \frac {x}{a-b}-\frac {2}{a\,\left ({\mathrm {e}}^{2\,x}-1\right )}-\frac {b^3\,\ln \left (a-b+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a^4-a^2\,b^2}-\frac {b\,\ln \left ({\mathrm {e}}^{2\,x}-1\right )}{a^2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________