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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0749499, antiderivative size = 112, normalized size of antiderivative = 1.26, number of steps used = 6, number of rules used = 4, integrand size = 14, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.286, Rules used = {3661, 1810, 633, 31} $-\frac{a b \tanh ^2(c+d x)}{d}-\frac{(a+b)^2 \log (1-\tanh (c+d x))}{2 d}+\frac{(a-b)^2 \log (\tanh (c+d x)+1)}{2 d}-\frac{b^2 \tanh ^5(c+d x)}{5 d}-\frac{b^2 \tanh ^3(c+d x)}{3 d}-\frac{b^2 \tanh (c+d x)}{d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 3661

Int[((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[(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, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rule 1810

Int[(Pq_)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Pq*(a + b*x^2)^p, x], x] /; FreeQ[{a,
b}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 633

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[-(a*c), 2]}, Dist[e/2 + (c*d)/(2*q),
Int[1/(-q + c*x), x], x] + Dist[e/2 - (c*d)/(2*q), Int[1/(q + c*x), x], x]] /; FreeQ[{a, c, d, e}, x] && NiceS
qrtQ[-(a*c)]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rubi steps

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

Mathematica [A]  time = 0.673195, size = 95, normalized size = 1.07 $-\frac{30 a b \tanh ^2(c+d x)+15 \left ((a+b)^2 \log (1-\tanh (c+d x))-(a-b)^2 \log (\tanh (c+d x)+1)\right )+6 b^2 \tanh ^5(c+d x)+10 b^2 \tanh ^3(c+d x)+30 b^2 \tanh (c+d x)}{30 d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

-(15*((a + b)^2*Log[1 - Tanh[c + d*x]] - (a - b)^2*Log[1 + Tanh[c + d*x]]) + 30*b^2*Tanh[c + d*x] + 30*a*b*Tan
h[c + d*x]^2 + 10*b^2*Tanh[c + d*x]^3 + 6*b^2*Tanh[c + d*x]^5)/(30*d)

________________________________________________________________________________________

Maple [A]  time = 0.006, size = 163, normalized size = 1.8 \begin{align*} -{\frac{{b}^{2} \left ( \tanh \left ( dx+c \right ) \right ) ^{5}}{5\,d}}-{\frac{{b}^{2} \left ( \tanh \left ( dx+c \right ) \right ) ^{3}}{3\,d}}-{\frac{ab \left ( \tanh \left ( dx+c \right ) \right ) ^{2}}{d}}-{\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*}

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

[In]

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

[Out]

-1/5*b^2*tanh(d*x+c)^5/d-1/3*b^2*tanh(d*x+c)^3/d-a*b*tanh(d*x+c)^2/d-b^2*tanh(d*x+c)/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.52232, size = 262, normalized size = 2.94 \begin{align*} \frac{1}{15} \, b^{2}{\left (15 \, x + \frac{15 \, c}{d} - \frac{2 \,{\left (70 \, e^{\left (-2 \, d x - 2 \, c\right )} + 140 \, e^{\left (-4 \, d x - 4 \, c\right )} + 90 \, e^{\left (-6 \, d x - 6 \, c\right )} + 45 \, e^{\left (-8 \, d x - 8 \, c\right )} + 23\right )}}{d{\left (5 \, e^{\left (-2 \, d x - 2 \, c\right )} + 10 \, e^{\left (-4 \, d x - 4 \, c\right )} + 10 \, e^{\left (-6 \, d x - 6 \, c\right )} + 5 \, e^{\left (-8 \, d x - 8 \, c\right )} + e^{\left (-10 \, d x - 10 \, 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 )} + a^{2} x \end{align*}

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

[In]

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

[Out]

1/15*b^2*(15*x + 15*c/d - 2*(70*e^(-2*d*x - 2*c) + 140*e^(-4*d*x - 4*c) + 90*e^(-6*d*x - 6*c) + 45*e^(-8*d*x -
8*c) + 23)/(d*(5*e^(-2*d*x - 2*c) + 10*e^(-4*d*x - 4*c) + 10*e^(-6*d*x - 6*c) + 5*e^(-8*d*x - 8*c) + e^(-10*d
*x - 10*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*x

________________________________________________________________________________________

Fricas [B]  time = 2.67561, size = 5516, normalized size = 61.98 \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

1/15*(15*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^10 + 150*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)*sinh(d*x + c)^9
+ 15*(a^2 - 2*a*b + b^2)*d*x*sinh(d*x + c)^10 + 15*(5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b + 6*b^2)*cosh(d*x + c)^8
+ 15*(45*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^2 + 5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b + 6*b^2)*sinh(d*x + c)^8
+ 120*(15*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^3 + (5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b + 6*b^2)*cosh(d*x + c)
)*sinh(d*x + c)^7 + 30*(5*(a^2 - 2*a*b + b^2)*d*x + 6*a*b + 6*b^2)*cosh(d*x + c)^6 + 30*(105*(a^2 - 2*a*b + b^
2)*d*x*cosh(d*x + c)^4 + 5*(a^2 - 2*a*b + b^2)*d*x + 14*(5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b + 6*b^2)*cosh(d*x +
c)^2 + 6*a*b + 6*b^2)*sinh(d*x + c)^6 + 60*(63*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^5 + 14*(5*(a^2 - 2*a*b +
b^2)*d*x + 4*a*b + 6*b^2)*cosh(d*x + c)^3 + 3*(5*(a^2 - 2*a*b + b^2)*d*x + 6*a*b + 6*b^2)*cosh(d*x + c))*sinh
(d*x + c)^5 + 10*(15*(a^2 - 2*a*b + b^2)*d*x + 18*a*b + 28*b^2)*cosh(d*x + c)^4 + 10*(315*(a^2 - 2*a*b + b^2)*
d*x*cosh(d*x + c)^6 + 105*(5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b + 6*b^2)*cosh(d*x + c)^4 + 15*(a^2 - 2*a*b + b^2)
*d*x + 45*(5*(a^2 - 2*a*b + b^2)*d*x + 6*a*b + 6*b^2)*cosh(d*x + c)^2 + 18*a*b + 28*b^2)*sinh(d*x + c)^4 + 40*
(45*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^7 + 21*(5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b + 6*b^2)*cosh(d*x + c)^5 +
15*(5*(a^2 - 2*a*b + b^2)*d*x + 6*a*b + 6*b^2)*cosh(d*x + c)^3 + (15*(a^2 - 2*a*b + b^2)*d*x + 18*a*b + 28*b^
2)*cosh(d*x + c))*sinh(d*x + c)^3 + 15*(a^2 - 2*a*b + b^2)*d*x + 5*(15*(a^2 - 2*a*b + b^2)*d*x + 12*a*b + 28*b
^2)*cosh(d*x + c)^2 + 5*(135*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^8 + 84*(5*(a^2 - 2*a*b + b^2)*d*x + 4*a*b +
6*b^2)*cosh(d*x + c)^6 + 90*(5*(a^2 - 2*a*b + b^2)*d*x + 6*a*b + 6*b^2)*cosh(d*x + c)^4 + 15*(a^2 - 2*a*b + b
^2)*d*x + 12*(15*(a^2 - 2*a*b + b^2)*d*x + 18*a*b + 28*b^2)*cosh(d*x + c)^2 + 12*a*b + 28*b^2)*sinh(d*x + c)^2
+ 46*b^2 + 30*(a*b*cosh(d*x + c)^10 + 10*a*b*cosh(d*x + c)*sinh(d*x + c)^9 + a*b*sinh(d*x + c)^10 + 5*a*b*cos
h(d*x + c)^8 + 5*(9*a*b*cosh(d*x + c)^2 + a*b)*sinh(d*x + c)^8 + 10*a*b*cosh(d*x + c)^6 + 40*(3*a*b*cosh(d*x +
c)^3 + a*b*cosh(d*x + c))*sinh(d*x + c)^7 + 10*(21*a*b*cosh(d*x + c)^4 + 14*a*b*cosh(d*x + c)^2 + a*b)*sinh(d
*x + c)^6 + 10*a*b*cosh(d*x + c)^4 + 4*(63*a*b*cosh(d*x + c)^5 + 70*a*b*cosh(d*x + c)^3 + 15*a*b*cosh(d*x + c)
)*sinh(d*x + c)^5 + 10*(21*a*b*cosh(d*x + c)^6 + 35*a*b*cosh(d*x + c)^4 + 15*a*b*cosh(d*x + c)^2 + a*b)*sinh(d
*x + c)^4 + 5*a*b*cosh(d*x + c)^2 + 40*(3*a*b*cosh(d*x + c)^7 + 7*a*b*cosh(d*x + c)^5 + 5*a*b*cosh(d*x + c)^3
+ a*b*cosh(d*x + c))*sinh(d*x + c)^3 + 5*(9*a*b*cosh(d*x + c)^8 + 28*a*b*cosh(d*x + c)^6 + 30*a*b*cosh(d*x + c
)^4 + 12*a*b*cosh(d*x + c)^2 + a*b)*sinh(d*x + c)^2 + a*b + 10*(a*b*cosh(d*x + c)^9 + 4*a*b*cosh(d*x + c)^7 +
6*a*b*cosh(d*x + c)^5 + 4*a*b*cosh(d*x + c)^3 + a*b*cosh(d*x + c))*sinh(d*x + c))*log(2*cosh(d*x + c)/(cosh(d*
x + c) - sinh(d*x + c))) + 10*(15*(a^2 - 2*a*b + b^2)*d*x*cosh(d*x + c)^9 + 12*(5*(a^2 - 2*a*b + b^2)*d*x + 4*
a*b + 6*b^2)*cosh(d*x + c)^7 + 18*(5*(a^2 - 2*a*b + b^2)*d*x + 6*a*b + 6*b^2)*cosh(d*x + c)^5 + 4*(15*(a^2 - 2
*a*b + b^2)*d*x + 18*a*b + 28*b^2)*cosh(d*x + c)^3 + (15*(a^2 - 2*a*b + b^2)*d*x + 12*a*b + 28*b^2)*cosh(d*x +
c))*sinh(d*x + c))/(d*cosh(d*x + c)^10 + 10*d*cosh(d*x + c)*sinh(d*x + c)^9 + d*sinh(d*x + c)^10 + 5*d*cosh(d
*x + c)^8 + 5*(9*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^8 + 40*(3*d*cosh(d*x + c)^3 + d*cosh(d*x + c))*sinh(d*x
+ c)^7 + 10*d*cosh(d*x + c)^6 + 10*(21*d*cosh(d*x + c)^4 + 14*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^6 + 4*(63*d
*cosh(d*x + c)^5 + 70*d*cosh(d*x + c)^3 + 15*d*cosh(d*x + c))*sinh(d*x + c)^5 + 10*d*cosh(d*x + c)^4 + 10*(21*
d*cosh(d*x + c)^6 + 35*d*cosh(d*x + c)^4 + 15*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^4 + 40*(3*d*cosh(d*x + c)^7
+ 7*d*cosh(d*x + c)^5 + 5*d*cosh(d*x + c)^3 + d*cosh(d*x + c))*sinh(d*x + c)^3 + 5*d*cosh(d*x + c)^2 + 5*(9*d
*cosh(d*x + c)^8 + 28*d*cosh(d*x + c)^6 + 30*d*cosh(d*x + c)^4 + 12*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^2 + 1
0*(d*cosh(d*x + c)^9 + 4*d*cosh(d*x + c)^7 + 6*d*cosh(d*x + c)^5 + 4*d*cosh(d*x + c)^3 + d*cosh(d*x + c))*sinh
(d*x + c) + d)

________________________________________________________________________________________

Sympy [A]  time = 0.772513, size = 100, normalized size = 1.12 \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} - \frac{a b \tanh ^{2}{\left (c + d x \right )}}{d} + b^{2} x - \frac{b^{2} \tanh ^{5}{\left (c + d x \right )}}{5 d} - \frac{b^{2} \tanh ^{3}{\left (c + d x \right )}}{3 d} - \frac{b^{2} \tanh{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (a + b \tanh ^{3}{\left (c \right )}\right )^{2} & \text{otherwise} \end{cases} \end{align*}

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

[In]

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

[Out]

Piecewise((a**2*x + 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*tanh(c +
d*x)**5/(5*d) - b**2*tanh(c + d*x)**3/(3*d) - b**2*tanh(c + d*x)/d, Ne(d, 0)), (x*(a + b*tanh(c)**3)**2, True
))

________________________________________________________________________________________

Giac [A]  time = 1.34766, size = 196, normalized size = 2.2 \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 \,{\left (23 \, b^{2} + 15 \,{\left (2 \, a b + 3 \, b^{2}\right )} e^{\left (8 \, d x + 8 \, c\right )} + 90 \,{\left (a b + b^{2}\right )} e^{\left (6 \, d x + 6 \, c\right )} + 10 \,{\left (9 \, a b + 14 \, b^{2}\right )} e^{\left (4 \, d x + 4 \, c\right )} + 10 \,{\left (3 \, a b + 7 \, b^{2}\right )} e^{\left (2 \, d x + 2 \, c\right )}\right )}}{15 \, d{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{5}} \end{align*}

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

[In]

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

[Out]

2*a*b*log(e^(2*d*x + 2*c) + 1)/d + (a^2 - 2*a*b + b^2)*(d*x + c)/d + 2/15*(23*b^2 + 15*(2*a*b + 3*b^2)*e^(8*d*
x + 8*c) + 90*(a*b + b^2)*e^(6*d*x + 6*c) + 10*(9*a*b + 14*b^2)*e^(4*d*x + 4*c) + 10*(3*a*b + 7*b^2)*e^(2*d*x
+ 2*c))/(d*(e^(2*d*x + 2*c) + 1)^5)