Optimal. Leaf size=94 \[ -\frac {b x}{a^2-b^2}+\frac {a \log (\cosh (x))}{a^2-b^2}+\frac {a^5 \log (a+b \tanh (x))}{b^4 \left (a^2-b^2\right )}-\frac {\left (a^2+b^2\right ) \tanh (x)}{b^3}+\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.26, antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.538, Rules used = {3647, 3728,
3729, 3707, 3698, 31, 3556} \begin {gather*} -\frac {b x}{a^2-b^2}+\frac {a \log (\cosh (x))}{a^2-b^2}-\frac {\left (a^2+b^2\right ) \tanh (x)}{b^3}+\frac {a^5 \log (a+b \tanh (x))}{b^4 \left (a^2-b^2\right )}+\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3556
Rule 3647
Rule 3698
Rule 3707
Rule 3728
Rule 3729
Rubi steps
\begin {align*} \int \frac {\tanh ^5(x)}{a+b \tanh (x)} \, dx &=-\frac {\tanh ^3(x)}{3 b}-\frac {\int \frac {\tanh ^2(x) \left (-3 a-3 b \tanh (x)+3 a \tanh ^2(x)\right )}{a+b \tanh (x)} \, dx}{3 b}\\ &=\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b}-\frac {\int \frac {\tanh (x) \left (6 a^2-6 \left (a^2+b^2\right ) \tanh ^2(x)\right )}{a+b \tanh (x)} \, dx}{6 b^2}\\ &=-\frac {\left (a^2+b^2\right ) \tanh (x)}{b^3}+\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b}-\frac {\int \frac {-6 a \left (a^2+b^2\right )-6 b^3 \tanh (x)+6 a \left (a^2+b^2\right ) \tanh ^2(x)}{a+b \tanh (x)} \, dx}{6 b^3}\\ &=-\frac {b x}{a^2-b^2}-\frac {\left (a^2+b^2\right ) \tanh (x)}{b^3}+\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b}+\frac {a \int \tanh (x) \, dx}{a^2-b^2}+\frac {a^5 \int \frac {1-\tanh ^2(x)}{a+b \tanh (x)} \, dx}{b^3 \left (a^2-b^2\right )}\\ &=-\frac {b x}{a^2-b^2}+\frac {a \log (\cosh (x))}{a^2-b^2}-\frac {\left (a^2+b^2\right ) \tanh (x)}{b^3}+\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b}+\frac {a^5 \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tanh (x)\right )}{b^4 \left (a^2-b^2\right )}\\ &=-\frac {b x}{a^2-b^2}+\frac {a \log (\cosh (x))}{a^2-b^2}+\frac {a^5 \log (a+b \tanh (x))}{b^4 \left (a^2-b^2\right )}-\frac {\left (a^2+b^2\right ) \tanh (x)}{b^3}+\frac {a \tanh ^2(x)}{2 b^2}-\frac {\tanh ^3(x)}{3 b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.41, size = 105, normalized size = 1.12 \begin {gather*} -\frac {6 b^5 x+6 a \left (a^4-b^4\right ) \log (\cosh (x))-6 a^5 \log (a \cosh (x)+b \sinh (x))+2 b \left (3 a^4+a^2 b^2-4 b^4\right ) \tanh (x)+b^2 \left (-a^2+b^2\right ) \text {sech}^2(x) (-3 a+2 b \tanh (x))}{6 (a-b) b^4 (a+b)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.32, size = 95, normalized size = 1.01
method | result | size |
derivativedivides | \(-\frac {\frac {b^{2} \left (\tanh ^{3}\left (x \right )\right )}{3}-\frac {a \left (\tanh ^{2}\left (x \right )\right ) b}{2}+a^{2} \tanh \left (x \right )+b^{2} \tanh \left (x \right )}{b^{3}}+\frac {a^{5} \ln \left (a +b \tanh \left (x \right )\right )}{b^{4} \left (a +b \right ) \left (a -b \right )}-\frac {\ln \left (\tanh \left (x \right )-1\right )}{2 b +2 a}-\frac {\ln \left (1+\tanh \left (x \right )\right )}{2 a -2 b}\) | \(95\) |
default | \(-\frac {\frac {b^{2} \left (\tanh ^{3}\left (x \right )\right )}{3}-\frac {a \left (\tanh ^{2}\left (x \right )\right ) b}{2}+a^{2} \tanh \left (x \right )+b^{2} \tanh \left (x \right )}{b^{3}}+\frac {a^{5} \ln \left (a +b \tanh \left (x \right )\right )}{b^{4} \left (a +b \right ) \left (a -b \right )}-\frac {\ln \left (\tanh \left (x \right )-1\right )}{2 b +2 a}-\frac {\ln \left (1+\tanh \left (x \right )\right )}{2 a -2 b}\) | \(95\) |
risch | \(\frac {x}{a +b}+\frac {2 a^{3} x}{b^{4}}+\frac {2 a x}{b^{2}}-\frac {2 x \,a^{5}}{b^{4} \left (a^{2}-b^{2}\right )}+\frac {2 a^{2} {\mathrm e}^{4 x}-2 a b \,{\mathrm e}^{4 x}+4 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}+2 a^{2}+\frac {8 b^{2}}{3}}{b^{3} \left (1+{\mathrm e}^{2 x}\right )^{3}}-\frac {a^{3} \ln \left (1+{\mathrm e}^{2 x}\right )}{b^{4}}-\frac {a \ln \left (1+{\mathrm e}^{2 x}\right )}{b^{2}}+\frac {a^{5} \ln \left ({\mathrm e}^{2 x}+\frac {a -b}{a +b}\right )}{b^{4} \left (a^{2}-b^{2}\right )}\) | \(184\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 150, normalized size = 1.60 \begin {gather*} \frac {a^{5} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{2} b^{4} - b^{6}} - \frac {2 \, {\left (3 \, a^{2} + 4 \, b^{2} + 3 \, {\left (2 \, a^{2} + a b + 2 \, b^{2}\right )} e^{\left (-2 \, x\right )} + 3 \, {\left (a^{2} + a b + 2 \, b^{2}\right )} e^{\left (-4 \, x\right )}\right )}}{3 \, {\left (3 \, b^{3} e^{\left (-2 \, x\right )} + 3 \, b^{3} e^{\left (-4 \, x\right )} + b^{3} e^{\left (-6 \, x\right )} + b^{3}\right )}} + \frac {x}{a + b} - \frac {{\left (a^{3} + a b^{2}\right )} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{b^{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. 1296 vs.
\(2 (90) = 180\).
time = 0.41, size = 1296, normalized size = 13.79 \begin {gather*} -\frac {3 \, {\left (a b^{4} + b^{5}\right )} x \cosh \left (x\right )^{6} + 18 \, {\left (a b^{4} + b^{5}\right )} x \cosh \left (x\right ) \sinh \left (x\right )^{5} + 3 \, {\left (a b^{4} + b^{5}\right )} x \sinh \left (x\right )^{6} - 6 \, a^{4} b - 2 \, a^{2} b^{3} + 8 \, b^{5} - 3 \, {\left (2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} + 2 \, a b^{4} - 4 \, b^{5} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \cosh \left (x\right )^{4} - 3 \, {\left (2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} + 2 \, a b^{4} - 4 \, b^{5} - 15 \, {\left (a b^{4} + b^{5}\right )} x \cosh \left (x\right )^{2} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \sinh \left (x\right )^{4} + 12 \, {\left (5 \, {\left (a b^{4} + b^{5}\right )} x \cosh \left (x\right )^{3} - {\left (2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} + 2 \, a b^{4} - 4 \, b^{5} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} - 3 \, {\left (4 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a b^{4} - 4 \, b^{5} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \cosh \left (x\right )^{2} + 3 \, {\left (15 \, {\left (a b^{4} + b^{5}\right )} x \cosh \left (x\right )^{4} - 4 \, a^{4} b + 2 \, a^{3} b^{2} - 2 \, a b^{4} + 4 \, b^{5} - 6 \, {\left (2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} + 2 \, a b^{4} - 4 \, b^{5} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \cosh \left (x\right )^{2} + 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \sinh \left (x\right )^{2} + 3 \, {\left (a b^{4} + b^{5}\right )} x - 3 \, {\left (a^{5} \cosh \left (x\right )^{6} + 6 \, a^{5} \cosh \left (x\right ) \sinh \left (x\right )^{5} + a^{5} \sinh \left (x\right )^{6} + 3 \, a^{5} \cosh \left (x\right )^{4} + 3 \, a^{5} \cosh \left (x\right )^{2} + a^{5} + 3 \, {\left (5 \, a^{5} \cosh \left (x\right )^{2} + a^{5}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (5 \, a^{5} \cosh \left (x\right )^{3} + 3 \, a^{5} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (5 \, a^{5} \cosh \left (x\right )^{4} + 6 \, a^{5} \cosh \left (x\right )^{2} + a^{5}\right )} \sinh \left (x\right )^{2} + 6 \, {\left (a^{5} \cosh \left (x\right )^{5} + 2 \, a^{5} \cosh \left (x\right )^{3} + a^{5} \cosh \left (x\right )\right )} \sinh \left (x\right )\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 ) + 3 \, {\left ({\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{6} + 6 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{5} + {\left (a^{5} - a b^{4}\right )} \sinh \left (x\right )^{6} + a^{5} - a b^{4} + 3 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{4} + 3 \, {\left (a^{5} - a b^{4} + 5 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (5 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{3} + 3 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{2} + 3 \, {\left (a^{5} - a b^{4} + 5 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{4} + 6 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 6 \, {\left ({\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{5} + 2 \, {\left (a^{5} - a b^{4}\right )} \cosh \left (x\right )^{3} + {\left (a^{5} - a b^{4}\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 b^{4} + b^{5}\right )} x \cosh \left (x\right )^{5} - 2 \, {\left (2 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a^{2} b^{3} + 2 \, a b^{4} - 4 \, b^{5} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \cosh \left (x\right )^{3} - {\left (4 \, a^{4} b - 2 \, a^{3} b^{2} + 2 \, a b^{4} - 4 \, b^{5} - 3 \, {\left (a b^{4} + b^{5}\right )} x\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}{3 \, {\left ({\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{6} + 6 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{5} + {\left (a^{2} b^{4} - b^{6}\right )} \sinh \left (x\right )^{6} + a^{2} b^{4} - b^{6} + 3 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{4} + 3 \, {\left (a^{2} b^{4} - b^{6} + 5 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (5 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{3} + 3 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{3} + 3 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{2} + 3 \, {\left (a^{2} b^{4} - b^{6} + 5 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{4} + 6 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 6 \, {\left ({\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{5} + 2 \, {\left (a^{2} b^{4} - b^{6}\right )} \cosh \left (x\right )^{3} + {\left (a^{2} b^{4} - b^{6}\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 [B] Leaf count of result is larger than twice the leaf count of optimal. 546 vs.
\(2 (78) = 156\).
time = 0.57, size = 546, normalized size = 5.81 \begin {gather*} \begin {cases} \tilde {\infty } \left (x - \frac {\tanh ^{3}{\left (x \right )}}{3} - \tanh {\left (x \right )}\right ) & \text {for}\: a = 0 \wedge b = 0 \\\frac {x - \log {\left (\tanh {\left (x \right )} + 1 \right )} - \frac {\tanh ^{4}{\left (x \right )}}{4} - \frac {\tanh ^{2}{\left (x \right )}}{2}}{a} & \text {for}\: b = 0 \\\frac {27 x \tanh {\left (x \right )}}{6 b \tanh {\left (x \right )} - 6 b} - \frac {27 x}{6 b \tanh {\left (x \right )} - 6 b} - \frac {12 \log {\left (\tanh {\left (x \right )} + 1 \right )} \tanh {\left (x \right )}}{6 b \tanh {\left (x \right )} - 6 b} + \frac {12 \log {\left (\tanh {\left (x \right )} + 1 \right )}}{6 b \tanh {\left (x \right )} - 6 b} - \frac {2 \tanh ^{4}{\left (x \right )}}{6 b \tanh {\left (x \right )} - 6 b} - \frac {\tanh ^{3}{\left (x \right )}}{6 b \tanh {\left (x \right )} - 6 b} - \frac {9 \tanh ^{2}{\left (x \right )}}{6 b \tanh {\left (x \right )} - 6 b} + \frac {15}{6 b \tanh {\left (x \right )} - 6 b} & \text {for}\: a = - b \\\frac {3 x \tanh {\left (x \right )}}{6 b \tanh {\left (x \right )} + 6 b} + \frac {3 x}{6 b \tanh {\left (x \right )} + 6 b} + \frac {12 \log {\left (\tanh {\left (x \right )} + 1 \right )} \tanh {\left (x \right )}}{6 b \tanh {\left (x \right )} + 6 b} + \frac {12 \log {\left (\tanh {\left (x \right )} + 1 \right )}}{6 b \tanh {\left (x \right )} + 6 b} - \frac {2 \tanh ^{4}{\left (x \right )}}{6 b \tanh {\left (x \right )} + 6 b} + \frac {\tanh ^{3}{\left (x \right )}}{6 b \tanh {\left (x \right )} + 6 b} - \frac {9 \tanh ^{2}{\left (x \right )}}{6 b \tanh {\left (x \right )} + 6 b} + \frac {15}{6 b \tanh {\left (x \right )} + 6 b} & \text {for}\: a = b \\\frac {6 a^{5} \log {\left (\frac {a}{b} + \tanh {\left (x \right )} \right )}}{6 a^{2} b^{4} - 6 b^{6}} - \frac {6 a^{4} b \tanh {\left (x \right )}}{6 a^{2} b^{4} - 6 b^{6}} + \frac {3 a^{3} b^{2} \tanh ^{2}{\left (x \right )}}{6 a^{2} b^{4} - 6 b^{6}} - \frac {2 a^{2} b^{3} \tanh ^{3}{\left (x \right )}}{6 a^{2} b^{4} - 6 b^{6}} + \frac {6 a b^{4} x}{6 a^{2} b^{4} - 6 b^{6}} - \frac {6 a b^{4} \log {\left (\tanh {\left (x \right )} + 1 \right )}}{6 a^{2} b^{4} - 6 b^{6}} - \frac {3 a b^{4} \tanh ^{2}{\left (x \right )}}{6 a^{2} b^{4} - 6 b^{6}} - \frac {6 b^{5} x}{6 a^{2} b^{4} - 6 b^{6}} + \frac {2 b^{5} \tanh ^{3}{\left (x \right )}}{6 a^{2} b^{4} - 6 b^{6}} + \frac {6 b^{5} \tanh {\left (x \right )}}{6 a^{2} b^{4} - 6 b^{6}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 142, normalized size = 1.51 \begin {gather*} \frac {a^{5} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{2} b^{4} - b^{6}} - \frac {x}{a - b} - \frac {{\left (a^{3} + a b^{2}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{b^{4}} + \frac {2 \, {\left (3 \, a^{2} b + 4 \, b^{3} + 3 \, {\left (a^{2} b - a b^{2} + 2 \, b^{3}\right )} e^{\left (4 \, x\right )} + 3 \, {\left (2 \, a^{2} b - a b^{2} + 2 \, b^{3}\right )} e^{\left (2 \, x\right )}\right )}}{3 \, b^{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 = 0.23, size = 85, normalized size = 0.90 \begin {gather*} \frac {x}{a+b}-\frac {{\mathrm {tanh}\left (x\right )}^3}{3\,b}-\frac {a\,\ln \left (\mathrm {tanh}\left (x\right )+1\right )}{a^2-b^2}+\frac {a\,{\mathrm {tanh}\left (x\right )}^2}{2\,b^2}-\frac {\mathrm {tanh}\left (x\right )\,\left (a^2+b^2\right )}{b^3}+\frac {a^5\,\ln \left (a+b\,\mathrm {tanh}\left (x\right )\right )}{b^4\,\left (a^2-b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________