Optimal. Leaf size=97 \[ \frac {a x}{a^2-b^2}-\frac {b \left (a^2+b^2\right ) \log (\cosh (x))}{a^4}-\frac {b^5 \log (b \cosh (x)+a \sinh (x))}{a^4 \left (a^2-b^2\right )}-\frac {\left (a^2+b^2\right ) \tanh (x)}{a^3}+\frac {b \tanh ^2(x)}{2 a^2}-\frac {\tanh ^3(x)}{3 a} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.36, antiderivative size = 97, normalized size of antiderivative = 1.00, 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 = {3650, 3730,
3731, 3732, 3611, 3556} \begin {gather*} \frac {a x}{a^2-b^2}+\frac {b \tanh ^2(x)}{2 a^2}-\frac {b \left (a^2+b^2\right ) \log (\cosh (x))}{a^4}-\frac {b^5 \log (a \sinh (x)+b \cosh (x))}{a^4 \left (a^2-b^2\right )}-\frac {\left (a^2+b^2\right ) \tanh (x)}{a^3}-\frac {\tanh ^3(x)}{3 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3611
Rule 3650
Rule 3730
Rule 3731
Rule 3732
Rubi steps
\begin {align*} \int \frac {\tanh ^4(x)}{a+b \coth (x)} \, dx &=-\frac {\tanh ^3(x)}{3 a}-\frac {i \int \frac {\left (-3 i b+3 i a \coth (x)+3 i b \coth ^2(x)\right ) \tanh ^3(x)}{a+b \coth (x)} \, dx}{3 a}\\ &=\frac {b \tanh ^2(x)}{2 a^2}-\frac {\tanh ^3(x)}{3 a}-\frac {\int \frac {\left (-6 \left (a^2+b^2\right )+6 b^2 \coth ^2(x)\right ) \tanh ^2(x)}{a+b \coth (x)} \, dx}{6 a^2}\\ &=-\frac {\left (a^2+b^2\right ) \tanh (x)}{a^3}+\frac {b \tanh ^2(x)}{2 a^2}-\frac {\tanh ^3(x)}{3 a}+\frac {i \int \frac {\left (6 i b \left (a^2+b^2\right )-6 i a^3 \coth (x)-6 i b \left (a^2+b^2\right ) \coth ^2(x)\right ) \tanh (x)}{a+b \coth (x)} \, dx}{6 a^3}\\ &=\frac {a x}{a^2-b^2}-\frac {\left (a^2+b^2\right ) \tanh (x)}{a^3}+\frac {b \tanh ^2(x)}{2 a^2}-\frac {\tanh ^3(x)}{3 a}-\frac {\left (i b^5\right ) \int \frac {-i b-i a \coth (x)}{a+b \coth (x)} \, dx}{a^4 \left (a^2-b^2\right )}-\frac {\left (b \left (a^2+b^2\right )\right ) \int \tanh (x) \, dx}{a^4}\\ &=\frac {a x}{a^2-b^2}-\frac {b \left (a^2+b^2\right ) \log (\cosh (x))}{a^4}-\frac {b^5 \log (b \cosh (x)+a \sinh (x))}{a^4 \left (a^2-b^2\right )}-\frac {\left (a^2+b^2\right ) \tanh (x)}{a^3}+\frac {b \tanh ^2(x)}{2 a^2}-\frac {\tanh ^3(x)}{3 a}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.25, size = 105, normalized size = 1.08 \begin {gather*} \frac {6 a^5 x+6 \left (-a^4 b+b^5\right ) \log (\cosh (x))-6 b^5 \log (b \cosh (x)+a \sinh (x))+\left (-8 a^5+2 a^3 b^2+6 a b^4\right ) \tanh (x)+a^2 \left (a^2-b^2\right ) \text {sech}^2(x) (-3 b+2 a \tanh (x))}{6 a^4 (a-b) (a+b)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(189\) vs.
\(2(93)=186\).
time = 0.68, size = 190, normalized size = 1.96
method | result | size |
risch | \(\frac {x}{a +b}+\frac {2 b x}{a^{2}}+\frac {2 x \,b^{3}}{a^{4}}+\frac {2 x \,b^{5}}{a^{4} \left (a^{2}-b^{2}\right )}+\frac {4 a^{2} {\mathrm e}^{4 x}-2 a b \,{\mathrm e}^{4 x}+2 b^{2} {\mathrm e}^{4 x}+4 a^{2} {\mathrm e}^{2 x}-2 a b \,{\mathrm e}^{2 x}+4 b^{2} {\mathrm e}^{2 x}+\frac {8 a^{2}}{3}+2 b^{2}}{a^{3} \left (1+{\mathrm e}^{2 x}\right )^{3}}-\frac {b \ln \left (1+{\mathrm e}^{2 x}\right )}{a^{2}}-\frac {b^{3} \ln \left (1+{\mathrm e}^{2 x}\right )}{a^{4}}-\frac {b^{5} \ln \left ({\mathrm e}^{2 x}-\frac {a -b}{a +b}\right )}{a^{4} \left (a^{2}-b^{2}\right )}\) | \(186\) |
default | \(-\frac {b^{5} \ln \left (b \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+2 a \tanh \left (\frac {x}{2}\right )+b \right )}{\left (a +b \right ) \left (a -b \right ) a^{4}}+\frac {64 \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{64 a -64 b}-\frac {64 \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{64 a +64 b}+\frac {\frac {2 \left (\left (-a^{3}-a \,b^{2}\right ) \left (\tanh ^{5}\left (\frac {x}{2}\right )\right )+a^{2} b \left (\tanh ^{4}\left (\frac {x}{2}\right )\right )+\left (-\frac {10}{3} a^{3}-2 a \,b^{2}\right ) \left (\tanh ^{3}\left (\frac {x}{2}\right )\right )+a^{2} b \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+\left (-a^{3}-a \,b^{2}\right ) \tanh \left (\frac {x}{2}\right )\right )}{\left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )^{3}}-b \left (a^{2}+b^{2}\right ) \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{a^{4}}\) | \(190\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 146, normalized size = 1.51 \begin {gather*} -\frac {b^{5} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} + a + b\right )}{a^{6} - a^{4} b^{2}} - \frac {2 \, {\left (4 \, a^{2} + 3 \, b^{2} + 3 \, {\left (2 \, a^{2} + a b + 2 \, b^{2}\right )} e^{\left (-2 \, x\right )} + 3 \, {\left (2 \, a^{2} + a b + b^{2}\right )} e^{\left (-4 \, x\right )}\right )}}{3 \, {\left (3 \, a^{3} e^{\left (-2 \, x\right )} + 3 \, a^{3} e^{\left (-4 \, x\right )} + a^{3} e^{\left (-6 \, x\right )} + a^{3}\right )}} + \frac {x}{a + b} - \frac {{\left (a^{2} b + b^{3}\right )} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{a^{4}} \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. 1294 vs.
\(2 (93) = 186\).
time = 0.40, size = 1294, normalized size = 13.34 \begin {gather*} \frac {3 \, {\left (a^{5} + a^{4} b\right )} x \cosh \left (x\right )^{6} + 18 \, {\left (a^{5} + a^{4} b\right )} x \cosh \left (x\right ) \sinh \left (x\right )^{5} + 3 \, {\left (a^{5} + a^{4} b\right )} x \sinh \left (x\right )^{6} + 8 \, a^{5} - 2 \, a^{3} b^{2} - 6 \, a b^{4} + 3 \, {\left (4 \, a^{5} - 2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - 2 \, a b^{4} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \cosh \left (x\right )^{4} + 3 \, {\left (4 \, a^{5} - 2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - 2 \, a b^{4} + 15 \, {\left (a^{5} + a^{4} b\right )} x \cosh \left (x\right )^{2} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \sinh \left (x\right )^{4} + 12 \, {\left (5 \, {\left (a^{5} + a^{4} b\right )} x \cosh \left (x\right )^{3} + {\left (4 \, a^{5} - 2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - 2 \, a b^{4} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (4 \, a^{5} - 2 \, a^{4} b + 2 \, a^{2} b^{3} - 4 \, a b^{4} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \cosh \left (x\right )^{2} + 3 \, {\left (15 \, {\left (a^{5} + a^{4} b\right )} x \cosh \left (x\right )^{4} + 4 \, a^{5} - 2 \, a^{4} b + 2 \, a^{2} b^{3} - 4 \, a b^{4} + 6 \, {\left (4 \, a^{5} - 2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - 2 \, a b^{4} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \cosh \left (x\right )^{2} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \sinh \left (x\right )^{2} + 3 \, {\left (a^{5} + a^{4} b\right )} x - 3 \, {\left (b^{5} \cosh \left (x\right )^{6} + 6 \, b^{5} \cosh \left (x\right ) \sinh \left (x\right )^{5} + b^{5} \sinh \left (x\right )^{6} + 3 \, b^{5} \cosh \left (x\right )^{4} + 3 \, b^{5} \cosh \left (x\right )^{2} + b^{5} + 3 \, {\left (5 \, b^{5} \cosh \left (x\right )^{2} + b^{5}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (5 \, b^{5} \cosh \left (x\right )^{3} + 3 \, b^{5} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (5 \, b^{5} \cosh \left (x\right )^{4} + 6 \, b^{5} \cosh \left (x\right )^{2} + b^{5}\right )} \sinh \left (x\right )^{2} + 6 \, {\left (b^{5} \cosh \left (x\right )^{5} + 2 \, b^{5} \cosh \left (x\right )^{3} + b^{5} \cosh \left (x\right )\right )} \sinh \left (x\right )\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 ) - 3 \, {\left ({\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{6} + 6 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{5} + {\left (a^{4} b - b^{5}\right )} \sinh \left (x\right )^{6} + a^{4} b - b^{5} + 3 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{4} + 3 \, {\left (a^{4} b - b^{5} + 5 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (5 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{3} + 3 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{2} + 3 \, {\left (a^{4} b - b^{5} + 5 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{4} + 6 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 6 \, {\left ({\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{5} + 2 \, {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )^{3} + {\left (a^{4} b - b^{5}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 6 \, {\left (3 \, {\left (a^{5} + a^{4} b\right )} x \cosh \left (x\right )^{5} + 2 \, {\left (4 \, a^{5} - 2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - 2 \, a b^{4} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \cosh \left (x\right )^{3} + {\left (4 \, a^{5} - 2 \, a^{4} b + 2 \, a^{2} b^{3} - 4 \, a b^{4} + 3 \, {\left (a^{5} + a^{4} b\right )} x\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}{3 \, {\left ({\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{6} + 6 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{5} + {\left (a^{6} - a^{4} b^{2}\right )} \sinh \left (x\right )^{6} + a^{6} - a^{4} b^{2} + 3 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{4} + 3 \, {\left (a^{6} - a^{4} b^{2} + 5 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (5 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{3} + 3 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{2} + 3 \, {\left (a^{6} - a^{4} b^{2} + 5 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{4} + 6 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 6 \, {\left ({\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{5} + 2 \, {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )^{3} + {\left (a^{6} - a^{4} b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )}} \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 {\tanh ^{4}{\left (x \right )}}{a + b \coth {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 141, normalized size = 1.45 \begin {gather*} -\frac {b^{5} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} - a + b \right |}\right )}{a^{6} - a^{4} b^{2}} + \frac {x}{a - b} - \frac {{\left (a^{2} b + b^{3}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{a^{4}} + \frac {2 \, {\left (4 \, a^{3} + 3 \, a b^{2} + 3 \, {\left (2 \, a^{3} - a^{2} b + a b^{2}\right )} e^{\left (4 \, x\right )} + 3 \, {\left (2 \, a^{3} - a^{2} b + 2 \, a b^{2}\right )} e^{\left (2 \, x\right )}\right )}}{3 \, a^{4} {\left (e^{\left (2 \, x\right )} + 1\right )}^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.61, size = 163, normalized size = 1.68 \begin {gather*} \frac {8}{3\,a\,\left (3\,{\mathrm {e}}^{2\,x}+3\,{\mathrm {e}}^{4\,x}+{\mathrm {e}}^{6\,x}+1\right )}+\frac {x}{a-b}-\frac {b^5\,\ln \left (b-a+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a^6-a^4\,b^2}-\frac {\ln \left ({\mathrm {e}}^{2\,x}+1\right )\,\left (a^2\,b+b^3\right )}{a^4}+\frac {2\,\left (2\,a^3+a^2\,b+b^3\right )}{a^3\,\left (a+b\right )\,\left ({\mathrm {e}}^{2\,x}+1\right )}-\frac {2\,\left (2\,a^2+a\,b-b^2\right )}{a^2\,\left (a+b\right )\,\left (2\,{\mathrm {e}}^{2\,x}+{\mathrm {e}}^{4\,x}+1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________