### 3.147 $$\int \tanh (c+d x) (a+b \tanh ^2(c+d x))^2 \, dx$$

Optimal. Leaf size=57 $-\frac{b (a+b) \tanh ^2(c+d x)}{2 d}-\frac{\left (a+b \tanh ^2(c+d x)\right )^2}{4 d}+\frac{(a+b)^2 \log (\cosh (c+d x))}{d}$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0733014, antiderivative size = 57, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 21, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.143, Rules used = {3670, 444, 43} $-\frac{b (a+b) \tanh ^2(c+d x)}{2 d}-\frac{\left (a+b \tanh ^2(c+d x)\right )^2}{4 d}+\frac{(a+b)^2 \log (\cosh (c+d x))}{d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
:> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 444

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] && NeQ[b*c - a*d, 0] && EqQ[m
- n + 1, 0]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int \tanh (c+d x) \left (a+b \tanh ^2(c+d x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{x \left (a+b x^2\right )^2}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=\frac{\operatorname{Subst}\left (\int \frac{(a+b x)^2}{1-x} \, dx,x,\tanh ^2(c+d x)\right )}{2 d}\\ &=\frac{\operatorname{Subst}\left (\int \left (-b (a+b)+\frac{(a+b)^2}{1-x}-b (a+b x)\right ) \, dx,x,\tanh ^2(c+d x)\right )}{2 d}\\ &=\frac{(a+b)^2 \log (\cosh (c+d x))}{d}-\frac{b (a+b) \tanh ^2(c+d x)}{2 d}-\frac{\left (a+b \tanh ^2(c+d x)\right )^2}{4 d}\\ \end{align*}

Mathematica [A]  time = 0.306984, size = 50, normalized size = 0.88 $-\frac{2 b (2 a+b) \tanh ^2(c+d x)-4 (a+b)^2 \log (\cosh (c+d x))+b^2 \tanh ^4(c+d x)}{4 d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B]  time = 0.004, size = 149, normalized size = 2.6 \begin{align*} -{\frac{ \left ( \tanh \left ( dx+c \right ) \right ) ^{4}{b}^{2}}{4\,d}}-{\frac{ab \left ( \tanh \left ( dx+c \right ) \right ) ^{2}}{d}}-{\frac{{b}^{2} \left ( \tanh \left ( dx+c \right ) \right ) ^{2}}{2\,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*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/4/d*tanh(d*x+c)^4*b^2-a*b*tanh(d*x+c)^2/d-1/2*b^2*tanh(d*x+c)^2/d-1/2*a^2/d*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(tanh(d*x+c)+1)*a^2-1/d*ln(tanh(d*x+c)+1)*a*b-1/2/d*ln(tanh(d
*x+c)+1)*b^2

________________________________________________________________________________________

Maxima [B]  time = 1.72274, size = 251, normalized size = 4.4 \begin{align*} b^{2}{\left (x + \frac{c}{d} + \frac{\log \left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}{d} + \frac{4 \,{\left (e^{\left (-2 \, d x - 2 \, c\right )} + e^{\left (-4 \, d x - 4 \, c\right )} + e^{\left (-6 \, d x - 6 \, c\right )}\right )}}{d{\left (4 \, e^{\left (-2 \, d x - 2 \, c\right )} + 6 \, e^{\left (-4 \, d x - 4 \, c\right )} + 4 \, e^{\left (-6 \, d x - 6 \, c\right )} + e^{\left (-8 \, d x - 8 \, c\right )} + 1\right )}}\right )} + 2 \, a b{\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 )} + \frac{a^{2} \log \left (\cosh \left (d x + c\right )\right )}{d} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.16579, size = 4165, normalized size = 73.07 \begin{align*} \text{result too large to display} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-((a^2 + 2*a*b + b^2)*d*x*cosh(d*x + c)^8 + 8*(a^2 + 2*a*b + b^2)*d*x*cosh(d*x + c)*sinh(d*x + c)^7 + (a^2 + 2
*a*b + b^2)*d*x*sinh(d*x + c)^8 + 4*((a^2 + 2*a*b + b^2)*d*x - a*b - b^2)*cosh(d*x + c)^6 + 4*(7*(a^2 + 2*a*b
+ b^2)*d*x*cosh(d*x + c)^2 + (a^2 + 2*a*b + b^2)*d*x - a*b - b^2)*sinh(d*x + c)^6 + 8*(7*(a^2 + 2*a*b + b^2)*d
*x*cosh(d*x + c)^3 + 3*((a^2 + 2*a*b + b^2)*d*x - a*b - b^2)*cosh(d*x + c))*sinh(d*x + c)^5 + 2*(3*(a^2 + 2*a*
b + b^2)*d*x - 4*a*b - 2*b^2)*cosh(d*x + c)^4 + 2*(35*(a^2 + 2*a*b + b^2)*d*x*cosh(d*x + c)^4 + 3*(a^2 + 2*a*b
+ b^2)*d*x + 30*((a^2 + 2*a*b + b^2)*d*x - a*b - b^2)*cosh(d*x + c)^2 - 4*a*b - 2*b^2)*sinh(d*x + c)^4 + 8*(7
*(a^2 + 2*a*b + b^2)*d*x*cosh(d*x + c)^5 + 10*((a^2 + 2*a*b + b^2)*d*x - a*b - b^2)*cosh(d*x + c)^3 + (3*(a^2
+ 2*a*b + b^2)*d*x - 4*a*b - 2*b^2)*cosh(d*x + c))*sinh(d*x + c)^3 + (a^2 + 2*a*b + b^2)*d*x + 4*((a^2 + 2*a*b
+ b^2)*d*x - a*b - b^2)*cosh(d*x + c)^2 + 4*(7*(a^2 + 2*a*b + b^2)*d*x*cosh(d*x + c)^6 + 15*((a^2 + 2*a*b + b
^2)*d*x - a*b - b^2)*cosh(d*x + c)^4 + (a^2 + 2*a*b + b^2)*d*x + 3*(3*(a^2 + 2*a*b + b^2)*d*x - 4*a*b - 2*b^2)
*cosh(d*x + c)^2 - a*b - b^2)*sinh(d*x + c)^2 - ((a^2 + 2*a*b + b^2)*cosh(d*x + c)^8 + 8*(a^2 + 2*a*b + b^2)*c
osh(d*x + c)*sinh(d*x + c)^7 + (a^2 + 2*a*b + b^2)*sinh(d*x + c)^8 + 4*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^6 + 4
*(7*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^2 + a^2 + 2*a*b + b^2)*sinh(d*x + c)^6 + 8*(7*(a^2 + 2*a*b + b^2)*cosh(d
*x + c)^3 + 3*(a^2 + 2*a*b + b^2)*cosh(d*x + c))*sinh(d*x + c)^5 + 6*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^4 + 2*(
35*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^4 + 30*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^2 + 3*a^2 + 6*a*b + 3*b^2)*sinh(
d*x + c)^4 + 8*(7*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^5 + 10*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^3 + 3*(a^2 + 2*a*
b + b^2)*cosh(d*x + c))*sinh(d*x + c)^3 + 4*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^2 + 4*(7*(a^2 + 2*a*b + b^2)*cos
h(d*x + c)^6 + 15*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^4 + 9*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^2 + a^2 + 2*a*b +
b^2)*sinh(d*x + c)^2 + a^2 + 2*a*b + b^2 + 8*((a^2 + 2*a*b + b^2)*cosh(d*x + c)^7 + 3*(a^2 + 2*a*b + b^2)*cosh
(d*x + c)^5 + 3*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^3 + (a^2 + 2*a*b + b^2)*cosh(d*x + c))*sinh(d*x + c))*log(2*
cosh(d*x + c)/(cosh(d*x + c) - sinh(d*x + c))) + 8*((a^2 + 2*a*b + b^2)*d*x*cosh(d*x + c)^7 + 3*((a^2 + 2*a*b
+ b^2)*d*x - a*b - b^2)*cosh(d*x + c)^5 + (3*(a^2 + 2*a*b + b^2)*d*x - 4*a*b - 2*b^2)*cosh(d*x + c)^3 + ((a^2
+ 2*a*b + b^2)*d*x - a*b - b^2)*cosh(d*x + c))*sinh(d*x + c))/(d*cosh(d*x + c)^8 + 8*d*cosh(d*x + c)*sinh(d*x
+ c)^7 + d*sinh(d*x + c)^8 + 4*d*cosh(d*x + c)^6 + 4*(7*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^6 + 8*(7*d*cosh(d
*x + c)^3 + 3*d*cosh(d*x + c))*sinh(d*x + c)^5 + 6*d*cosh(d*x + c)^4 + 2*(35*d*cosh(d*x + c)^4 + 30*d*cosh(d*x
+ c)^2 + 3*d)*sinh(d*x + c)^4 + 8*(7*d*cosh(d*x + c)^5 + 10*d*cosh(d*x + c)^3 + 3*d*cosh(d*x + c))*sinh(d*x +
c)^3 + 4*d*cosh(d*x + c)^2 + 4*(7*d*cosh(d*x + c)^6 + 15*d*cosh(d*x + c)^4 + 9*d*cosh(d*x + c)^2 + d)*sinh(d*
x + c)^2 + 8*(d*cosh(d*x + c)^7 + 3*d*cosh(d*x + c)^5 + 3*d*cosh(d*x + c)^3 + d*cosh(d*x + c))*sinh(d*x + c) +
d)

________________________________________________________________________________________

Sympy [A]  time = 0.704204, size = 122, normalized size = 2.14 \begin{align*} \begin{cases} a^{2} x - \frac{a^{2} \log{\left (\tanh{\left (c + d x \right )} + 1 \right )}}{d} + 2 a b x - \frac{2 a b \log{\left (\tanh{\left (c + d x \right )} + 1 \right )}}{d} - \frac{a b \tanh ^{2}{\left (c + d x \right )}}{d} + b^{2} x - \frac{b^{2} \log{\left (\tanh{\left (c + d x \right )} + 1 \right )}}{d} - \frac{b^{2} \tanh ^{4}{\left (c + d x \right )}}{4 d} - \frac{b^{2} \tanh ^{2}{\left (c + d x \right )}}{2 d} & \text{for}\: d \neq 0 \\x \left (a + b \tanh ^{2}{\left (c \right )}\right )^{2} \tanh{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [B]  time = 1.26775, size = 162, normalized size = 2.84 \begin{align*} -\frac{{\left (a^{2} + 2 \, a b + b^{2}\right )}{\left (d x + c\right )}}{d} + \frac{{\left (a^{2} + 2 \, a b + b^{2}\right )} \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}{d} + \frac{4 \,{\left ({\left (a b + b^{2}\right )} e^{\left (6 \, d x + 6 \, c\right )} +{\left (2 \, a b + b^{2}\right )} e^{\left (4 \, d x + 4 \, c\right )} +{\left (a b + b^{2}\right )} e^{\left (2 \, d x + 2 \, c\right )}\right )}}{d{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{4}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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