3.60 \(\int (a+b \tanh (c+d x))^2 \, dx\)

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]

(a^2+b^2)*x+2*a*b*ln(cosh(d*x+c))/d-b^2*tanh(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 38, normalized size of antiderivative = 1.00, 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]

Int[(a + b*Tanh[c + d*x])^2,x]

[Out]

(a^2 + b^2)*x + (2*a*b*Log[Cosh[c + d*x]])/d - (b^2*Tanh[c + d*x])/d

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3477

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[(b^2*Tan[c + d*x])/d, x]) /; FreeQ[{a, b, c, d}, x]

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.11, 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]

Integrate[(a + b*Tanh[c + d*x])^2,x]

[Out]

(-((a + b)^2*Log[1 - Tanh[c + d*x]]) + (a - b)^2*Log[1 + Tanh[c + d*x]] - 2*b^2*Tanh[c + d*x])/(2*d)

________________________________________________________________________________________

fricas [B]  time = 0.57, size = 201, normalized size = 5.29 \[ \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} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))^2,x, algorithm="fricas")

[Out]

((a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^2 + 2*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)*sinh(d*x + c) + (a^2 - 2*a*
b + b^2)*d*x*sinh(d*x + c)^2 + (a^2 - 2*a*b + b^2)*d*x + 2*b^2 + 2*(a*b*cosh(d*x + c)^2 + 2*a*b*cosh(d*x + c)*
sinh(d*x + c) + a*b*sinh(d*x + c)^2 + a*b)*log(2*cosh(d*x + c)/(cosh(d*x + c) - sinh(d*x + c))))/(d*cosh(d*x +
 c)^2 + 2*d*cosh(d*x + c)*sinh(d*x + c) + d*sinh(d*x + c)^2 + d)

________________________________________________________________________________________

giac [A]  time = 0.12, size = 56, normalized size = 1.47 \[ \frac {2 \, a b \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) + {\left (a^{2} - 2 \, a b + b^{2}\right )} {\left (d x + c\right )} + \frac {2 \, b^{2}}{e^{\left (2 \, d x + 2 \, c\right )} + 1}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))^2,x, algorithm="giac")

[Out]

(2*a*b*log(e^(2*d*x + 2*c) + 1) + (a^2 - 2*a*b + b^2)*(d*x + c) + 2*b^2/(e^(2*d*x + 2*c) + 1))/d

________________________________________________________________________________________

maple [B]  time = 0.01, size = 116, normalized size = 3.05 \[ -\frac {b^{2} \tanh \left (d x +c \right )}{d}-\frac {a^{2} \ln \left (\tanh \left (d x +c \right )-1\right )}{2 d}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right ) a b}{d}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right ) b^{2}}{2 d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) a^{2}}{2 d}-\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) a b}{d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) b^{2}}{2 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tanh(d*x+c))^2,x)

[Out]

-b^2*tanh(d*x+c)/d-1/2/d*a^2*ln(tanh(d*x+c)-1)-1/d*ln(tanh(d*x+c)-1)*a*b-1/2/d*ln(tanh(d*x+c)-1)*b^2+1/2/d*ln(
1+tanh(d*x+c))*a^2-1/d*ln(1+tanh(d*x+c))*a*b+1/2/d*ln(1+tanh(d*x+c))*b^2

________________________________________________________________________________________

maxima [A]  time = 0.31, size = 49, normalized size = 1.29 \[ 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} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))^2,x, algorithm="maxima")

[Out]

b^2*(x + c/d - 2/(d*(e^(-2*d*x - 2*c) + 1))) + a^2*x + 2*a*b*log(cosh(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 1.04, size = 44, normalized size = 1.16 \[ x\,\left (a^2+2\,a\,b+b^2\right )-\frac {b^2\,\mathrm {tanh}\left (c+d\,x\right )}{d}-\frac {2\,a\,b\,\ln \left (\mathrm {tanh}\left (c+d\,x\right )+1\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tanh(c + d*x))^2,x)

[Out]

x*(2*a*b + a^2 + b^2) - (b^2*tanh(c + d*x))/d - (2*a*b*log(tanh(c + d*x) + 1))/d

________________________________________________________________________________________

sympy [A]  time = 0.19, size = 54, normalized size = 1.42 \[ \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 {\relax (c )}\right )^{2} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c))**2,x)

[Out]

Piecewise((a**2*x + 2*a*b*x - 2*a*b*log(tanh(c + d*x) + 1)/d + b**2*x - b**2*tanh(c + d*x)/d, Ne(d, 0)), (x*(a
 + b*tanh(c))**2, True))

________________________________________________________________________________________