Optimal. Leaf size=60 \[ \frac{a x}{a^2-b^2}-\frac{b^3 \log (a \sinh (x)+b \cosh (x))}{a^2 \left (a^2-b^2\right )}-\frac{b \log (\cosh (x))}{a^2}-\frac{\tanh (x)}{a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.193089, antiderivative size = 60, normalized size of antiderivative = 1., 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 = {3569, 3651, 3530, 3475} \[ \frac{a x}{a^2-b^2}-\frac{b^3 \log (a \sinh (x)+b \cosh (x))}{a^2 \left (a^2-b^2\right )}-\frac{b \log (\cosh (x))}{a^2}-\frac{\tanh (x)}{a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3569
Rule 3651
Rule 3530
Rule 3475
Rubi steps
\begin{align*} \int \frac{\tanh ^2(x)}{a+b \coth (x)} \, dx &=-\frac{\tanh (x)}{a}-\frac{i \int \frac{\left (-i b+i a \coth (x)+i b \coth ^2(x)\right ) \tanh (x)}{a+b \coth (x)} \, dx}{a}\\ &=\frac{a x}{a^2-b^2}-\frac{\tanh (x)}{a}-\frac{b \int \tanh (x) \, dx}{a^2}-\frac{\left (i b^3\right ) \int \frac{-i b-i a \coth (x)}{a+b \coth (x)} \, dx}{a^2 \left (a^2-b^2\right )}\\ &=\frac{a x}{a^2-b^2}-\frac{b \log (\cosh (x))}{a^2}-\frac{b^3 \log (b \cosh (x)+a \sinh (x))}{a^2 \left (a^2-b^2\right )}-\frac{\tanh (x)}{a}\\ \end{align*}
Mathematica [A] time = 0.131647, size = 64, normalized size = 1.07 \[ \frac{\left (a b^2-a^3\right ) \tanh (x)+\left (b^3-a^2 b\right ) \log (\cosh (x))+a^3 x-b^3 \log (a \sinh (x)+b \cosh (x))}{a^4-a^2 b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.046, size = 110, normalized size = 1.8 \begin{align*} 16\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) +1 \right ) }{16\,a-16\,b}}-16\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) -1 \right ) }{16\,a+16\,b}}-2\,{\frac{\tanh \left ( x/2 \right ) }{a \left ( \left ( \tanh \left ( x/2 \right ) \right ) ^{2}+1 \right ) }}-{\frac{b}{{a}^{2}}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+1 \right ) }-{\frac{{b}^{3}}{ \left ( a+b \right ) \left ( a-b \right ){a}^{2}}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}b+2\,a\tanh \left ( x/2 \right ) +b \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.78454, size = 90, normalized size = 1.5 \begin{align*} -\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 (-2 \, x\right )} + 1\right )}{a^{2}} - \frac{2}{a e^{\left (-2 \, x\right )} + a} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.98597, size = 660, normalized size = 11. \begin{align*} \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 (b \cosh \left (x\right ) + a \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 \, \cosh \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{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\tanh ^{2}{\left (x \right )}}{a + b \coth{\left (x \right )}}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.13413, size = 100, normalized size = 1.67 \begin{align*} -\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 (e^{\left (2 \, x\right )} + 1\right )}{a^{2}} + \frac{2}{a{\left (e^{\left (2 \, x\right )} + 1\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]