### 3.171 $$\int \frac{\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx$$

Optimal. Leaf size=59 $\frac{a^{3/2} \tan ^{-1}\left (\frac{\sqrt{b} \tanh (c+d x)}{\sqrt{a}}\right )}{b^{3/2} d (a+b)}+\frac{x}{a+b}-\frac{\tanh (c+d x)}{b d}$

[Out]

x/(a + b) + (a^(3/2)*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/(b^(3/2)*(a + b)*d) - Tanh[c + d*x]/(b*d)

________________________________________________________________________________________

Rubi [A]  time = 0.10793, antiderivative size = 59, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 23, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.217, Rules used = {3670, 479, 522, 206, 205} $\frac{a^{3/2} \tan ^{-1}\left (\frac{\sqrt{b} \tanh (c+d x)}{\sqrt{a}}\right )}{b^{3/2} d (a+b)}+\frac{x}{a+b}-\frac{\tanh (c+d x)}{b d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

x/(a + b) + (a^(3/2)*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/(b^(3/2)*(a + b)*d) - Tanh[c + d*x]/(b*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 479

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

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
/; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

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

Mathematica [A]  time = 0.172031, size = 66, normalized size = 1.12 $\frac{a^{3/2} \tan ^{-1}\left (\frac{\sqrt{b} \tanh (c+d x)}{\sqrt{a}}\right )}{b^{3/2} d (a+b)}+\frac{c+d x}{d (a+b)}-\frac{\tanh (c+d x)}{b d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(c + d*x)/((a + b)*d) + (a^(3/2)*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/(b^(3/2)*(a + b)*d) - Tanh[c + d*x]/
(b*d)

________________________________________________________________________________________

Maple [A]  time = 0.02, size = 95, normalized size = 1.6 \begin{align*} -{\frac{\tanh \left ( dx+c \right ) }{bd}}+{\frac{\ln \left ( \tanh \left ( dx+c \right ) +1 \right ) }{d \left ( 2\,b+2\,a \right ) }}+{\frac{{a}^{2}}{d \left ( a+b \right ) b}\arctan \left ({b\tanh \left ( dx+c \right ){\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}-{\frac{\ln \left ( \tanh \left ( dx+c \right ) -1 \right ) }{d \left ( 2\,b+2\,a \right ) }} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

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

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.23915, size = 2043, normalized size = 34.63 \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)^4/(a+b*tanh(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/2*(2*b*d*x*cosh(d*x + c)^2 + 4*b*d*x*cosh(d*x + c)*sinh(d*x + c) + 2*b*d*x*sinh(d*x + c)^2 + 2*b*d*x + (a*c
osh(d*x + c)^2 + 2*a*cosh(d*x + c)*sinh(d*x + c) + a*sinh(d*x + c)^2 + a)*sqrt(-a/b)*log(((a^2 + 2*a*b + b^2)*
cosh(d*x + c)^4 + 4*(a^2 + 2*a*b + b^2)*cosh(d*x + c)*sinh(d*x + c)^3 + (a^2 + 2*a*b + b^2)*sinh(d*x + c)^4 +
2*(a^2 - b^2)*cosh(d*x + c)^2 + 2*(3*(a^2 + 2*a*b + b^2)*cosh(d*x + c)^2 + a^2 - b^2)*sinh(d*x + c)^2 + a^2 -
6*a*b + b^2 + 4*((a^2 + 2*a*b + b^2)*cosh(d*x + c)^3 + (a^2 - b^2)*cosh(d*x + c))*sinh(d*x + c) + 4*((a*b + b^
2)*cosh(d*x + c)^2 + 2*(a*b + b^2)*cosh(d*x + c)*sinh(d*x + c) + (a*b + b^2)*sinh(d*x + c)^2 + a*b - b^2)*sqrt
(-a/b))/((a + b)*cosh(d*x + c)^4 + 4*(a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (a + b)*sinh(d*x + c)^4 + 2*(a -
b)*cosh(d*x + c)^2 + 2*(3*(a + b)*cosh(d*x + c)^2 + a - b)*sinh(d*x + c)^2 + 4*((a + b)*cosh(d*x + c)^3 + (a -
b)*cosh(d*x + c))*sinh(d*x + c) + a + b)) + 4*a + 4*b)/((a*b + b^2)*d*cosh(d*x + c)^2 + 2*(a*b + b^2)*d*cosh(
d*x + c)*sinh(d*x + c) + (a*b + b^2)*d*sinh(d*x + c)^2 + (a*b + b^2)*d), (b*d*x*cosh(d*x + c)^2 + 2*b*d*x*cosh
(d*x + c)*sinh(d*x + c) + b*d*x*sinh(d*x + c)^2 + b*d*x + (a*cosh(d*x + c)^2 + 2*a*cosh(d*x + c)*sinh(d*x + c)
+ a*sinh(d*x + c)^2 + a)*sqrt(a/b)*arctan(1/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)*sqrt(a/b)/a) + 2*a + 2*b)/((a*b + b^2)*d*cosh(d*x + c)^2 + 2*(a*b + b^2)*
d*cosh(d*x + c)*sinh(d*x + c) + (a*b + b^2)*d*sinh(d*x + c)^2 + (a*b + b^2)*d)]

________________________________________________________________________________________

Sympy [A]  time = 21.1208, size = 495, normalized size = 8.39 \begin{align*} \begin{cases} \tilde{\infty } x \tanh ^{2}{\left (c \right )} & \text{for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac{x - \frac{\tanh ^{3}{\left (c + d x \right )}}{3 d} - \frac{\tanh{\left (c + d x \right )}}{d}}{a} & \text{for}\: b = 0 \\\frac{x - \frac{\tanh{\left (c + d x \right )}}{d}}{b} & \text{for}\: a = 0 \\\frac{3 d x \tanh ^{2}{\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} - \frac{3 d x}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} - \frac{2 \tanh ^{3}{\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} + \frac{3 \tanh{\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} & \text{for}\: a = - b \\\frac{x \tanh ^{4}{\left (c \right )}}{a + b \tanh ^{2}{\left (c \right )}} & \text{for}\: d = 0 \\- \frac{2 i a^{\frac{3}{2}} b \sqrt{\frac{1}{b}} \tanh{\left (c + d x \right )}}{2 i a^{\frac{3}{2}} b^{2} d \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{3} d \sqrt{\frac{1}{b}}} + \frac{2 i \sqrt{a} b^{2} d x \sqrt{\frac{1}{b}}}{2 i a^{\frac{3}{2}} b^{2} d \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{3} d \sqrt{\frac{1}{b}}} - \frac{2 i \sqrt{a} b^{2} \sqrt{\frac{1}{b}} \tanh{\left (c + d x \right )}}{2 i a^{\frac{3}{2}} b^{2} d \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{3} d \sqrt{\frac{1}{b}}} + \frac{a^{2} \log{\left (- i \sqrt{a} \sqrt{\frac{1}{b}} + \tanh{\left (c + d x \right )} \right )}}{2 i a^{\frac{3}{2}} b^{2} d \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{3} d \sqrt{\frac{1}{b}}} - \frac{a^{2} \log{\left (i \sqrt{a} \sqrt{\frac{1}{b}} + \tanh{\left (c + d x \right )} \right )}}{2 i a^{\frac{3}{2}} b^{2} d \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{3} d \sqrt{\frac{1}{b}}} & \text{otherwise} \end{cases} \end{align*}

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

[In]

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

[Out]

Piecewise((zoo*x*tanh(c)**2, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), ((x - tanh(c + d*x)**3/(3*d) - tanh(c + d*x)/d)/
a, Eq(b, 0)), ((x - tanh(c + d*x)/d)/b, Eq(a, 0)), (3*d*x*tanh(c + d*x)**2/(2*b*d*tanh(c + d*x)**2 - 2*b*d) -
3*d*x/(2*b*d*tanh(c + d*x)**2 - 2*b*d) - 2*tanh(c + d*x)**3/(2*b*d*tanh(c + d*x)**2 - 2*b*d) + 3*tanh(c + d*x)
/(2*b*d*tanh(c + d*x)**2 - 2*b*d), Eq(a, -b)), (x*tanh(c)**4/(a + b*tanh(c)**2), Eq(d, 0)), (-2*I*a**(3/2)*b*s
qrt(1/b)*tanh(c + d*x)/(2*I*a**(3/2)*b**2*d*sqrt(1/b) + 2*I*sqrt(a)*b**3*d*sqrt(1/b)) + 2*I*sqrt(a)*b**2*d*x*s
qrt(1/b)/(2*I*a**(3/2)*b**2*d*sqrt(1/b) + 2*I*sqrt(a)*b**3*d*sqrt(1/b)) - 2*I*sqrt(a)*b**2*sqrt(1/b)*tanh(c +
d*x)/(2*I*a**(3/2)*b**2*d*sqrt(1/b) + 2*I*sqrt(a)*b**3*d*sqrt(1/b)) + a**2*log(-I*sqrt(a)*sqrt(1/b) + tanh(c +
d*x))/(2*I*a**(3/2)*b**2*d*sqrt(1/b) + 2*I*sqrt(a)*b**3*d*sqrt(1/b)) - a**2*log(I*sqrt(a)*sqrt(1/b) + tanh(c
+ d*x))/(2*I*a**(3/2)*b**2*d*sqrt(1/b) + 2*I*sqrt(a)*b**3*d*sqrt(1/b)), True))

________________________________________________________________________________________

Giac [A]  time = 1.20782, size = 126, normalized size = 2.14 \begin{align*} \frac{a^{2} \arctan \left (\frac{a e^{\left (2 \, d x + 2 \, c\right )} + b e^{\left (2 \, d x + 2 \, c\right )} + a - b}{2 \, \sqrt{a b}}\right )}{{\left (a b d + b^{2} d\right )} \sqrt{a b}} + \frac{d x + c}{a d + b d} + \frac{2}{b d{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}} \end{align*}

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

[In]

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

[Out]

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