Optimal. Leaf size=38 \[ x \left (a^2+b^2\right )+\frac{2 a b \log (\cosh (c+d x))}{d}-\frac{b^2 \tanh (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0226947, antiderivative size = 38, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 12, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167, Rules used = {3477, 3475} \[ x \left (a^2+b^2\right )+\frac{2 a b \log (\cosh (c+d x))}{d}-\frac{b^2 \tanh (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3477
Rule 3475
Rubi steps
\begin{align*} \int (a+b \tanh (c+d x))^2 \, dx &=\left (a^2+b^2\right ) x-\frac{b^2 \tanh (c+d x)}{d}+(2 a b) \int \tanh (c+d x) \, dx\\ &=\left (a^2+b^2\right ) x+\frac{2 a b \log (\cosh (c+d x))}{d}-\frac{b^2 \tanh (c+d x)}{d}\\ \end{align*}
Mathematica [A] time = 0.0951131, size = 54, normalized size = 1.42 \[ \frac{(a-b)^2 \log (\tanh (c+d x)+1)-(a+b)^2 \log (1-\tanh (c+d x))-2 b^2 \tanh (c+d x)}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.004, size = 116, normalized size = 3.1 \begin{align*} -{\frac{{b}^{2}\tanh \left ( dx+c \right ) }{d}}-{\frac{{a}^{2}\ln \left ( \tanh \left ( dx+c \right ) -1 \right ) }{2\,d}}-{\frac{\ln \left ( \tanh \left ( dx+c \right ) -1 \right ) ab}{d}}-{\frac{\ln \left ( \tanh \left ( dx+c \right ) -1 \right ){b}^{2}}{2\,d}}+{\frac{\ln \left ( \tanh \left ( dx+c \right ) +1 \right ){a}^{2}}{2\,d}}-{\frac{\ln \left ( \tanh \left ( dx+c \right ) +1 \right ) ab}{d}}+{\frac{\ln \left ( \tanh \left ( dx+c \right ) +1 \right ){b}^{2}}{2\,d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.12727, size = 66, normalized size = 1.74 \begin{align*} b^{2}{\left (x + \frac{c}{d} - \frac{2}{d{\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}}\right )} + a^{2} x + \frac{2 \, a b \log \left (\cosh \left (d x + c\right )\right )}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.21507, size = 535, normalized size = 14.08 \begin{align*} \frac{{\left (a^{2} - 2 \, a b + b^{2}\right )} d x \cosh \left (d x + c\right )^{2} + 2 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) +{\left (a^{2} - 2 \, a b + b^{2}\right )} d x \sinh \left (d x + c\right )^{2} +{\left (a^{2} - 2 \, a b + b^{2}\right )} d x + 2 \, b^{2} + 2 \,{\left (a b \cosh \left (d x + c\right )^{2} + 2 \, a b \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a b \sinh \left (d x + c\right )^{2} + a b\right )} \log \left (\frac{2 \, \cosh \left (d x + c\right )}{\cosh \left (d x + c\right ) - \sinh \left (d x + c\right )}\right )}{d \cosh \left (d x + c\right )^{2} + 2 \, d \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + d \sinh \left (d x + c\right )^{2} + d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 0.224003, size = 54, normalized size = 1.42 \begin{align*} \begin{cases} a^{2} x + 2 a b x - \frac{2 a b \log{\left (\tanh{\left (c + d x \right )} + 1 \right )}}{d} + b^{2} x - \frac{b^{2} \tanh{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (a + b \tanh{\left (c \right )}\right )^{2} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.23799, size = 82, normalized size = 2.16 \begin{align*} \frac{2 \, a b \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}{d} + \frac{{\left (a^{2} - 2 \, a b + b^{2}\right )}{\left (d x + c\right )}}{d} + \frac{2 \, b^{2}}{d{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]