### 3.992 $$\int \frac{\text{sech}^2(x) (a+b \tanh (x))^3}{c+d \tanh (x)} \, dx$$

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.162722, antiderivative size = 78, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 21, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.095, Rules used = {4342, 43} $\frac{b \tanh (x) (b c-a d)^2}{d^3}-\frac{(b c-a d) (a+b \tanh (x))^2}{2 d^2}-\frac{(b c-a d)^3 \log (c+d \tanh (x))}{d^4}+\frac{(a+b \tanh (x))^3}{3 d}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 4342

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
+ b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

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 \frac{\text{sech}^2(x) (a+b \tanh (x))^3}{c+d \tanh (x)} \, dx &=\operatorname{Subst}\left (\int \frac{(a+b x)^3}{c+d x} \, dx,x,\tanh (x)\right )\\ &=\operatorname{Subst}\left (\int \left (\frac{b (b c-a d)^2}{d^3}-\frac{b (b c-a d) (a+b x)}{d^2}+\frac{b (a+b x)^2}{d}+\frac{(-b c+a d)^3}{d^3 (c+d x)}\right ) \, dx,x,\tanh (x)\right )\\ &=-\frac{(b c-a d)^3 \log (c+d \tanh (x))}{d^4}+\frac{b (b c-a d)^2 \tanh (x)}{d^3}-\frac{(b c-a d) (a+b \tanh (x))^2}{2 d^2}+\frac{(a+b \tanh (x))^3}{3 d}\\ \end{align*}

Mathematica [A]  time = 0.785405, size = 134, normalized size = 1.72 $\frac{(a+b \tanh (x))^3 (c \cosh (x)+d \sinh (x)) \left (b d^2 \left (\sinh (2 x) \left (9 a^2 d-9 a b c+b^2 d\right )+b (-9 a d+3 b c-2 b d \tanh (x))\right )+6 \cosh ^2(x) (b c-a d)^3 (\log (\cosh (x))-\log (c \cosh (x)+d \sinh (x)))+6 b^3 c^2 d \sinh (x) \cosh (x)\right )}{6 d^4 (c+d \tanh (x)) (a \cosh (x)+b \sinh (x))^3}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

((c*Cosh[x] + d*Sinh[x])*(a + b*Tanh[x])^3*(6*(b*c - a*d)^3*Cosh[x]^2*(Log[Cosh[x]] - Log[c*Cosh[x] + d*Sinh[x
]]) + 6*b^3*c^2*d*Cosh[x]*Sinh[x] + b*d^2*((-9*a*b*c + 9*a^2*d + b^2*d)*Sinh[2*x] + b*(3*b*c - 9*a*d - 2*b*d*T
anh[x]))))/(6*d^4*(a*Cosh[x] + b*Sinh[x])^3*(c + d*Tanh[x]))

________________________________________________________________________________________

Maple [B]  time = 0.082, size = 542, normalized size = 7. \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

6/d/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^5*a^2*b-6/d^2/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^5*a*b^2*c+2/d^3/(tanh(1/2*x)
^2+1)^3*tanh(1/2*x)^5*b^3*c^2+6/d/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^4*a*b^2-2/d^2/(tanh(1/2*x)^2+1)^3*tanh(1/2*x
)^4*b^3*c+12/d/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^3*a^2*b-12/d^2/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^3*a*b^2*c+4/d^3/
(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^3*b^3*c^2+8/3/d/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^3*b^3+6/d/(tanh(1/2*x)^2+1)^3*
tanh(1/2*x)^2*a*b^2-2/d^2/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)^2*b^3*c+6/d/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)*a^2*b-6/
d^2/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)*a*b^2*c+2/d^3/(tanh(1/2*x)^2+1)^3*tanh(1/2*x)*b^3*c^2-1/d*ln(tanh(1/2*x)^2
+1)*a^3+3/d^2*ln(tanh(1/2*x)^2+1)*a^2*b*c-3/d^3*ln(tanh(1/2*x)^2+1)*c^2*b^2*a+1/d^4*ln(tanh(1/2*x)^2+1)*c^3*b^
3+1/d*ln(tanh(1/2*x)^2*c+2*tanh(1/2*x)*d+c)*a^3-3/d^2*ln(tanh(1/2*x)^2*c+2*tanh(1/2*x)*d+c)*a^2*b*c+3/d^3*ln(t
anh(1/2*x)^2*c+2*tanh(1/2*x)*d+c)*c^2*b^2*a-1/d^4*ln(tanh(1/2*x)^2*c+2*tanh(1/2*x)*d+c)*c^3*b^3

________________________________________________________________________________________

Maxima [B]  time = 1.63636, size = 373, normalized size = 4.78 \begin{align*} \frac{1}{3} \, b^{3}{\left (\frac{2 \,{\left (3 \, c^{2} + d^{2} + 3 \,{\left (2 \, c^{2} + c d\right )} e^{\left (-2 \, x\right )} + 3 \,{\left (c^{2} + c d + d^{2}\right )} e^{\left (-4 \, x\right )}\right )}}{3 \, d^{3} e^{\left (-2 \, x\right )} + 3 \, d^{3} e^{\left (-4 \, x\right )} + d^{3} e^{\left (-6 \, x\right )} + d^{3}} - \frac{3 \, c^{3} \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{4}} + \frac{3 \, c^{3} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{4}}\right )} - 3 \, a b^{2}{\left (\frac{2 \,{\left ({\left (c + d\right )} e^{\left (-2 \, x\right )} + c\right )}}{2 \, d^{2} e^{\left (-2 \, x\right )} + d^{2} e^{\left (-4 \, x\right )} + d^{2}} - \frac{c^{2} \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{3}} + \frac{c^{2} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{3}}\right )} - 3 \, a^{2} b{\left (\frac{c \log \left (-{\left (c - d\right )} e^{\left (-2 \, x\right )} - c - d\right )}{d^{2}} - \frac{c \log \left (e^{\left (-2 \, x\right )} + 1\right )}{d^{2}} - \frac{2}{d e^{\left (-2 \, x\right )} + d}\right )} + \frac{a^{3} \log \left (d \tanh \left (x\right ) + c\right )}{d} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.70859, size = 4383, normalized size = 56.19 \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

-1/3*(6*b^3*c^2*d - 18*a*b^2*c*d^2 + 6*(b^3*c^2*d - (3*a*b^2 + b^3)*c*d^2 + (3*a^2*b + 3*a*b^2 + b^3)*d^3)*cos
h(x)^4 + 24*(b^3*c^2*d - (3*a*b^2 + b^3)*c*d^2 + (3*a^2*b + 3*a*b^2 + b^3)*d^3)*cosh(x)*sinh(x)^3 + 6*(b^3*c^2
*d - (3*a*b^2 + b^3)*c*d^2 + (3*a^2*b + 3*a*b^2 + b^3)*d^3)*sinh(x)^4 + 2*(9*a^2*b + b^3)*d^3 + 6*(2*b^3*c^2*d
- (6*a*b^2 + b^3)*c*d^2 + 3*(2*a^2*b + a*b^2)*d^3)*cosh(x)^2 + 6*(2*b^3*c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*d + 3*a^2*b*c*d^2 - a^3*d^3)*cosh(x)^5 + 2*(b^3*c^3 - 3*a*b^2*c^2*d + 3*a^2*b*
c*d^2 - a^3*d^3)*cosh(x)^3 + (b^3*c^3 - 3*a*b^2*c^2*d + 3*a^2*b*c*d^2 - a^3*d^3)*cosh(x))*sinh(x))*log(2*cosh(
x)/(cosh(x) - sinh(x))) + 12*(2*(b^3*c^2*d - (3*a*b^2 + b^3)*c*d^2 + (3*a^2*b + 3*a*b^2 + b^3)*d^3)*cosh(x)^3
+ (2*b^3*c^2*d - (6*a*b^2 + b^3)*c*d^2 + 3*(2*a^2*b + a*b^2)*d^3)*cosh(x))*sinh(x))/(d^4*cosh(x)^6 + 6*d^4*cos
h(x)*sinh(x)^5 + d^4*sinh(x)^6 + 3*d^4*cosh(x)^4 + 3*d^4*cosh(x)^2 + 3*(5*d^4*cosh(x)^2 + d^4)*sinh(x)^4 + d^4
+ 4*(5*d^4*cosh(x)^3 + 3*d^4*cosh(x))*sinh(x)^3 + 3*(5*d^4*cosh(x)^4 + 6*d^4*cosh(x)^2 + d^4)*sinh(x)^2 + 6*(
d^4*cosh(x)^5 + 2*d^4*cosh(x)^3 + d^4*cosh(x))*sinh(x))

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

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

[In]

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

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.18165, size = 733, normalized size = 9.4 \begin{align*} -\frac{{\left (b^{3} c^{4} - 3 \, a b^{2} c^{3} d + b^{3} c^{3} d + 3 \, a^{2} b c^{2} d^{2} - 3 \, a b^{2} c^{2} d^{2} - a^{3} c d^{3} + 3 \, a^{2} b c d^{3} - a^{3} d^{4}\right )} \log \left ({\left | c e^{\left (2 \, x\right )} + d e^{\left (2 \, x\right )} + c - d \right |}\right )}{c d^{4} + d^{5}} + \frac{{\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \log \left (e^{\left (2 \, x\right )} + 1\right )}{d^{4}} - \frac{11 \, b^{3} c^{3} e^{\left (6 \, x\right )} - 33 \, a b^{2} c^{2} d e^{\left (6 \, x\right )} + 33 \, a^{2} b c d^{2} e^{\left (6 \, x\right )} - 11 \, a^{3} d^{3} e^{\left (6 \, x\right )} + 33 \, b^{3} c^{3} e^{\left (4 \, x\right )} - 99 \, a b^{2} c^{2} d e^{\left (4 \, x\right )} + 12 \, b^{3} c^{2} d e^{\left (4 \, x\right )} + 99 \, a^{2} b c d^{2} e^{\left (4 \, x\right )} - 36 \, a b^{2} c d^{2} e^{\left (4 \, x\right )} - 12 \, b^{3} c d^{2} e^{\left (4 \, x\right )} - 33 \, a^{3} d^{3} e^{\left (4 \, x\right )} + 36 \, a^{2} b d^{3} e^{\left (4 \, x\right )} + 36 \, a b^{2} d^{3} e^{\left (4 \, x\right )} + 12 \, b^{3} d^{3} e^{\left (4 \, x\right )} + 33 \, b^{3} c^{3} e^{\left (2 \, x\right )} - 99 \, a b^{2} c^{2} d e^{\left (2 \, x\right )} + 24 \, b^{3} c^{2} d e^{\left (2 \, x\right )} + 99 \, a^{2} b c d^{2} e^{\left (2 \, x\right )} - 72 \, a b^{2} c d^{2} e^{\left (2 \, x\right )} - 12 \, b^{3} c d^{2} e^{\left (2 \, x\right )} - 33 \, a^{3} d^{3} e^{\left (2 \, x\right )} + 72 \, a^{2} b d^{3} e^{\left (2 \, x\right )} + 36 \, a b^{2} d^{3} e^{\left (2 \, x\right )} + 11 \, b^{3} c^{3} - 33 \, a b^{2} c^{2} d + 12 \, b^{3} c^{2} d + 33 \, a^{2} b c d^{2} - 36 \, a b^{2} c d^{2} - 11 \, a^{3} d^{3} + 36 \, a^{2} b d^{3} + 4 \, b^{3} d^{3}}{6 \, d^{4}{\left (e^{\left (2 \, x\right )} + 1\right )}^{3}} \end{align*}

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

[In]

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

[Out]

-(b^3*c^4 - 3*a*b^2*c^3*d + b^3*c^3*d + 3*a^2*b*c^2*d^2 - 3*a*b^2*c^2*d^2 - a^3*c*d^3 + 3*a^2*b*c*d^3 - a^3*d^
4)*log(abs(c*e^(2*x) + d*e^(2*x) + c - d))/(c*d^4 + d^5) + (b^3*c^3 - 3*a*b^2*c^2*d + 3*a^2*b*c*d^2 - a^3*d^3)
*log(e^(2*x) + 1)/d^4 - 1/6*(11*b^3*c^3*e^(6*x) - 33*a*b^2*c^2*d*e^(6*x) + 33*a^2*b*c*d^2*e^(6*x) - 11*a^3*d^3
*e^(6*x) + 33*b^3*c^3*e^(4*x) - 99*a*b^2*c^2*d*e^(4*x) + 12*b^3*c^2*d*e^(4*x) + 99*a^2*b*c*d^2*e^(4*x) - 36*a*
b^2*c*d^2*e^(4*x) - 12*b^3*c*d^2*e^(4*x) - 33*a^3*d^3*e^(4*x) + 36*a^2*b*d^3*e^(4*x) + 36*a*b^2*d^3*e^(4*x) +
12*b^3*d^3*e^(4*x) + 33*b^3*c^3*e^(2*x) - 99*a*b^2*c^2*d*e^(2*x) + 24*b^3*c^2*d*e^(2*x) + 99*a^2*b*c*d^2*e^(2*
x) - 72*a*b^2*c*d^2*e^(2*x) - 12*b^3*c*d^2*e^(2*x) - 33*a^3*d^3*e^(2*x) + 72*a^2*b*d^3*e^(2*x) + 36*a*b^2*d^3*
e^(2*x) + 11*b^3*c^3 - 33*a*b^2*c^2*d + 12*b^3*c^2*d + 33*a^2*b*c*d^2 - 36*a*b^2*c*d^2 - 11*a^3*d^3 + 36*a^2*b
*d^3 + 4*b^3*d^3)/(d^4*(e^(2*x) + 1)^3)