Optimal. Leaf size=69 \[ a \left (a^2+3 b^2\right ) x+\frac {b \left (3 a^2+b^2\right ) \log (\cosh (c+d x))}{d}-\frac {2 a b^2 \tanh (c+d x)}{d}-\frac {b (a+b \tanh (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 69, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3563, 3606,
3556} \begin {gather*} \frac {b \left (3 a^2+b^2\right ) \log (\cosh (c+d x))}{d}+a x \left (a^2+3 b^2\right )-\frac {2 a b^2 \tanh (c+d x)}{d}-\frac {b (a+b \tanh (c+d x))^2}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3563
Rule 3606
Rubi steps
\begin {align*} \int (a+b \tanh (c+d x))^3 \, dx &=-\frac {b (a+b \tanh (c+d x))^2}{2 d}+\int (a+b \tanh (c+d x)) \left (a^2+b^2+2 a b \tanh (c+d x)\right ) \, dx\\ &=a \left (a^2+3 b^2\right ) x-\frac {2 a b^2 \tanh (c+d x)}{d}-\frac {b (a+b \tanh (c+d x))^2}{2 d}+\left (b \left (3 a^2+b^2\right )\right ) \int \tanh (c+d x) \, dx\\ &=a \left (a^2+3 b^2\right ) x+\frac {b \left (3 a^2+b^2\right ) \log (\cosh (c+d x))}{d}-\frac {2 a b^2 \tanh (c+d x)}{d}-\frac {b (a+b \tanh (c+d x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.24, size = 67, normalized size = 0.97 \begin {gather*} -\frac {(a+b)^3 \log (1-\tanh (c+d x))-(a-b)^3 \log (1+\tanh (c+d x))+6 a b^2 \tanh (c+d x)+b^3 \tanh ^2(c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.26, size = 93, normalized size = 1.35
method | result | size |
derivativedivides | \(\frac {-\frac {b^{3} \left (\tanh ^{2}\left (d x +c \right )\right )}{2}-3 a \,b^{2} \tanh \left (d x +c \right )-\frac {\left (a^{3}+3 a^{2} b +3 a \,b^{2}+b^{3}\right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}+\frac {\left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right ) \ln \left (\tanh \left (d x +c \right )+1\right )}{2}}{d}\) | \(93\) |
default | \(\frac {-\frac {b^{3} \left (\tanh ^{2}\left (d x +c \right )\right )}{2}-3 a \,b^{2} \tanh \left (d x +c \right )-\frac {\left (a^{3}+3 a^{2} b +3 a \,b^{2}+b^{3}\right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}+\frac {\left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right ) \ln \left (\tanh \left (d x +c \right )+1\right )}{2}}{d}\) | \(93\) |
risch | \(a^{3} x -3 a^{2} b x +3 a \,b^{2} x -b^{3} x -\frac {6 a^{2} b c}{d}-\frac {2 b^{3} c}{d}+\frac {2 b^{2} \left (3 a \,{\mathrm e}^{2 d x +2 c}+b \,{\mathrm e}^{2 d x +2 c}+3 a \right )}{d \left (1+{\mathrm e}^{2 d x +2 c}\right )^{2}}+\frac {3 b \ln \left (1+{\mathrm e}^{2 d x +2 c}\right ) a^{2}}{d}+\frac {b^{3} \ln \left (1+{\mathrm e}^{2 d x +2 c}\right )}{d}\) | \(134\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 118, normalized size = 1.71 \begin {gather*} b^{3} {\left (x + \frac {c}{d} + \frac {\log \left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}{d} + \frac {2 \, e^{\left (-2 \, d x - 2 \, c\right )}}{d {\left (2 \, e^{\left (-2 \, d x - 2 \, c\right )} + e^{\left (-4 \, d x - 4 \, c\right )} + 1\right )}}\right )} + 3 \, a b^{2} {\left (x + \frac {c}{d} - \frac {2}{d {\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}}\right )} + a^{3} x + \frac {3 \, a^{2} b \log \left (\cosh \left (d x + c\right )\right )}{d} \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. 646 vs.
\(2 (67) = 134\).
time = 0.41, size = 646, normalized size = 9.36 \begin {gather*} \frac {{\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x \cosh \left (d x + c\right )^{4} + 4 \, {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x \sinh \left (d x + c\right )^{4} + 6 \, a b^{2} + {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x + 2 \, {\left (3 \, a b^{2} + b^{3} + {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x \cosh \left (d x + c\right )^{2} + 3 \, a b^{2} + b^{3} + {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x\right )} \sinh \left (d x + c\right )^{2} + {\left ({\left (3 \, a^{2} b + b^{3}\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (3 \, a^{2} b + b^{3}\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (3 \, a^{2} b + b^{3}\right )} \sinh \left (d x + c\right )^{4} + 3 \, a^{2} b + b^{3} + 2 \, {\left (3 \, a^{2} b + b^{3}\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, a^{2} b + b^{3} + 3 \, {\left (3 \, a^{2} b + b^{3}\right )} \cosh \left (d x + c\right )^{2}\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left ({\left (3 \, a^{2} b + b^{3}\right )} \cosh \left (d x + c\right )^{3} + {\left (3 \, a^{2} b + b^{3}\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right )\right )} \log \left (\frac {2 \, \cosh \left (d x + c\right )}{\cosh \left (d x + c\right ) - \sinh \left (d x + c\right )}\right ) + 4 \, {\left ({\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x \cosh \left (d x + c\right )^{3} + {\left (3 \, a b^{2} + b^{3} + {\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} d x\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right )}{d \cosh \left (d x + c\right )^{4} + 4 \, d \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + d \sinh \left (d x + c\right )^{4} + 2 \, d \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, d \cosh \left (d x + c\right )^{2} + d\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left (d \cosh \left (d x + c\right )^{3} + d \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.11, size = 100, normalized size = 1.45 \begin {gather*} \begin {cases} a^{3} x + 3 a^{2} b x - \frac {3 a^{2} b \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} + 3 a b^{2} x - \frac {3 a b^{2} \tanh {\left (c + d x \right )}}{d} + b^{3} x - \frac {b^{3} \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} - \frac {b^{3} \tanh ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tanh {\left (c \right )}\right )^{3} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.44, size = 97, normalized size = 1.41 \begin {gather*} \frac {{\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} {\left (d x + c\right )} + {\left (3 \, a^{2} b + b^{3}\right )} \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) + \frac {2 \, {\left (3 \, a b^{2} + {\left (3 \, a b^{2} + b^{3}\right )} e^{\left (2 \, d x + 2 \, c\right )}\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.11, size = 77, normalized size = 1.12 \begin {gather*} x\,\left (a^3+3\,a^2\,b+3\,a\,b^2+b^3\right )-\frac {\ln \left (\mathrm {tanh}\left (c+d\,x\right )+1\right )\,\left (3\,a^2\,b+b^3\right )}{d}-\frac {b^3\,{\mathrm {tanh}\left (c+d\,x\right )}^2}{2\,d}-\frac {3\,a\,b^2\,\mathrm {tanh}\left (c+d\,x\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________