Optimal. Leaf size=76 \[ \frac{a x}{a^2-b^2}-\frac{a^4 \log (a+b \tanh (x))}{b^3 \left (a^2-b^2\right )}-\frac{b \log (\cosh (x))}{a^2-b^2}+\frac{a \tanh (x)}{b^2}-\frac{\tanh ^2(x)}{2 b} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.213464, antiderivative size = 76, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.462, Rules used = {3566, 3647, 3627, 3617, 31, 3475} \[ \frac{a x}{a^2-b^2}-\frac{a^4 \log (a+b \tanh (x))}{b^3 \left (a^2-b^2\right )}-\frac{b \log (\cosh (x))}{a^2-b^2}+\frac{a \tanh (x)}{b^2}-\frac{\tanh ^2(x)}{2 b} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3566
Rule 3647
Rule 3627
Rule 3617
Rule 31
Rule 3475
Rubi steps
\begin{align*} \int \frac{\tanh ^4(x)}{a+b \tanh (x)} \, dx &=-\frac{\tanh ^2(x)}{2 b}-\frac{\int \frac{\tanh (x) \left (-2 a-2 b \tanh (x)+2 a \tanh ^2(x)\right )}{a+b \tanh (x)} \, dx}{2 b}\\ &=\frac{a \tanh (x)}{b^2}-\frac{\tanh ^2(x)}{2 b}-\frac{\int \frac{2 a^2-2 \left (a^2+b^2\right ) \tanh ^2(x)}{a+b \tanh (x)} \, dx}{2 b^2}\\ &=\frac{a x}{a^2-b^2}+\frac{a \tanh (x)}{b^2}-\frac{\tanh ^2(x)}{2 b}-\frac{a^4 \int \frac{1-\tanh ^2(x)}{a+b \tanh (x)} \, dx}{b^2 \left (a^2-b^2\right )}-\frac{b \int \tanh (x) \, dx}{a^2-b^2}\\ &=\frac{a x}{a^2-b^2}-\frac{b \log (\cosh (x))}{a^2-b^2}+\frac{a \tanh (x)}{b^2}-\frac{\tanh ^2(x)}{2 b}-\frac{a^4 \operatorname{Subst}\left (\int \frac{1}{a+x} \, dx,x,b \tanh (x)\right )}{b^3 \left (a^2-b^2\right )}\\ &=\frac{a x}{a^2-b^2}-\frac{b \log (\cosh (x))}{a^2-b^2}-\frac{a^4 \log (a+b \tanh (x))}{b^3 \left (a^2-b^2\right )}+\frac{a \tanh (x)}{b^2}-\frac{\tanh ^2(x)}{2 b}\\ \end{align*}
Mathematica [A] time = 0.273711, size = 88, normalized size = 1.16 \[ \frac{b^2 \left (a^2-b^2\right ) \text{sech}^2(x)+2 \left (a b \left (a^2-b^2\right ) \tanh (x)+\left (a^4-b^4\right ) \log (\cosh (x))+a^4 (-\log (a \cosh (x)+b \sinh (x)))+a b^3 x\right )}{2 b^3 (a-b) (a+b)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.022, size = 76, normalized size = 1. \begin{align*} -{\frac{ \left ( \tanh \left ( x \right ) \right ) ^{2}}{2\,b}}+{\frac{a\tanh \left ( x \right ) }{{b}^{2}}}+{\frac{\ln \left ( 1+\tanh \left ( x \right ) \right ) }{2\,a-2\,b}}-{\frac{\ln \left ( \tanh \left ( x \right ) -1 \right ) }{2\,b+2\,a}}-{\frac{{a}^{4}\ln \left ( a+b\tanh \left ( x \right ) \right ) }{{b}^{3} \left ( a+b \right ) \left ( a-b \right ) }} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.83016, size = 135, normalized size = 1.78 \begin{align*} -\frac{a^{4} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{2} b^{3} - b^{5}} + \frac{2 \,{\left ({\left (a + b\right )} e^{\left (-2 \, x\right )} + a\right )}}{2 \, b^{2} e^{\left (-2 \, x\right )} + b^{2} e^{\left (-4 \, x\right )} + b^{2}} + \frac{x}{a + b} + \frac{{\left (a^{2} + b^{2}\right )} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{b^{3}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.51416, size = 1538, normalized size = 20.24 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 105.921, size = 442, normalized size = 5.82 \begin{align*} \begin{cases} \tilde{\infty } \left (x - \log{\left (\tanh{\left (x \right )} + 1 \right )} - \frac{\tanh ^{2}{\left (x \right )}}{2}\right ) & \text{for}\: a = 0 \wedge b = 0 \\\frac{x - \frac{\tanh ^{3}{\left (x \right )}}{3} - \tanh{\left (x \right )}}{a} & \text{for}\: b = 0 \\\frac{7 x \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} - \frac{7 x}{2 b \tanh{\left (x \right )} - 2 b} - \frac{4 \log{\left (\tanh{\left (x \right )} + 1 \right )} \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} + \frac{4 \log{\left (\tanh{\left (x \right )} + 1 \right )}}{2 b \tanh{\left (x \right )} - 2 b} - \frac{\tanh ^{3}{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} - \frac{\tanh ^{2}{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} + \frac{3}{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{4 \log{\left (\tanh{\left (x \right )} + 1 \right )} \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} + 2 b} - \frac{4 \log{\left (\tanh{\left (x \right )} + 1 \right )}}{2 b \tanh{\left (x \right )} + 2 b} - \frac{\tanh ^{3}{\left (x \right )}}{2 b \tanh{\left (x \right )} + 2 b} + \frac{\tanh ^{2}{\left (x \right )}}{2 b \tanh{\left (x \right )} + 2 b} - \frac{3}{2 b \tanh{\left (x \right )} + 2 b} & \text{for}\: a = b \\- \frac{2 a^{4} \log{\left (\frac{a}{b} + \tanh{\left (x \right )} \right )}}{2 a^{2} b^{3} - 2 b^{5}} + \frac{2 a^{3} b \tanh{\left (x \right )}}{2 a^{2} b^{3} - 2 b^{5}} - \frac{a^{2} b^{2} \tanh ^{2}{\left (x \right )}}{2 a^{2} b^{3} - 2 b^{5}} + \frac{2 a b^{3} x}{2 a^{2} b^{3} - 2 b^{5}} - \frac{2 a b^{3} \tanh{\left (x \right )}}{2 a^{2} b^{3} - 2 b^{5}} - \frac{2 b^{4} x}{2 a^{2} b^{3} - 2 b^{5}} + \frac{2 b^{4} \log{\left (\tanh{\left (x \right )} + 1 \right )}}{2 a^{2} b^{3} - 2 b^{5}} + \frac{b^{4} \tanh ^{2}{\left (x \right )}}{2 a^{2} b^{3} - 2 b^{5}} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.31051, size = 132, normalized size = 1.74 \begin{align*} -\frac{a^{4} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{2} b^{3} - b^{5}} + \frac{x}{a - b} + \frac{{\left (a^{2} + b^{2}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{b^{3}} - \frac{2 \,{\left (a b +{\left (a b - b^{2}\right )} e^{\left (2 \, x\right )}\right )}}{b^{3}{\left (e^{\left (2 \, x\right )} + 1\right )}^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]