3.135 \(\int \frac{\tanh ^3(x)}{a+b \tanh (x)} \, dx\)

Optimal. Leaf size=64 \[ -\frac{b x}{a^2-b^2}+\frac{a^3 \log (a+b \tanh (x))}{b^2 \left (a^2-b^2\right )}+\frac{a \log (\cosh (x))}{a^2-b^2}-\frac{\tanh (x)}{b} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.128603, antiderivative size = 64, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.385, Rules used = {3566, 3626, 3617, 31, 3475} \[ -\frac{b x}{a^2-b^2}+\frac{a^3 \log (a+b \tanh (x))}{b^2 \left (a^2-b^2\right )}+\frac{a \log (\cosh (x))}{a^2-b^2}-\frac{\tanh (x)}{b} \]

Antiderivative was successfully verified.

[In]

Int[Tanh[x]^3/(a + b*Tanh[x]),x]

[Out]

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

Rule 3566

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Si
mp[(b^2*(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^(n + 1))/(d*f*(m + n - 1)), x] + Dist[1/(d*(m + n -
1)), Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n - 1) - b^2*(b*c*(m - 2) + a*d*(
1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2,
 x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]
&& IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || IntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0]
&& NeQ[a, 0])))

Rule 3626

Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/((a_.) + (b_.)*tan[(e_.) + (f_.)*
(x_)]), x_Symbol] :> Simp[((a*A + b*B - a*C)*x)/(a^2 + b^2), x] + (Dist[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2), I
nt[(1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Dist[(A*b - a*B - b*C)/(a^2 + b^2), Int[Tan[e + f*x], x
], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a
*B - b*C, 0]

Rule 3617

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[
A/(b*f), Subst[Int[(a + x)^m, x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]

Rule 31

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

Rule 3475

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

Rubi steps

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

Mathematica [A]  time = 0.120322, size = 65, normalized size = 1.02 \[ \frac{\left (b^3-a^2 b\right ) \tanh (x)+\left (a b^2-a^3\right ) \log (\cosh (x))+a^3 \log (a \cosh (x)+b \sinh (x))-b^3 x}{b^2 (a-b) (a+b)} \]

Antiderivative was successfully verified.

[In]

Integrate[Tanh[x]^3/(a + b*Tanh[x]),x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.02, size = 67, normalized size = 1.1 \begin{align*} -{\frac{\tanh \left ( x \right ) }{b}}-{\frac{\ln \left ( 1+\tanh \left ( x \right ) \right ) }{2\,a-2\,b}}-{\frac{\ln \left ( \tanh \left ( x \right ) -1 \right ) }{2\,b+2\,a}}+{\frac{{a}^{3}\ln \left ( a+b\tanh \left ( x \right ) \right ) }{{b}^{2} \left ( a+b \right ) \left ( a-b \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(x)^3/(a+b*tanh(x)),x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.8459, size = 96, normalized size = 1.5 \begin{align*} \frac{a^{3} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{2} b^{2} - b^{4}} + \frac{x}{a + b} - \frac{a \log \left (e^{\left (-2 \, x\right )} + 1\right )}{b^{2}} - \frac{2}{b e^{\left (-2 \, x\right )} + b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.49475, size = 662, normalized size = 10.34 \begin{align*} -\frac{{\left (a b^{2} + b^{3}\right )} x \cosh \left (x\right )^{2} + 2 \,{\left (a b^{2} + b^{3}\right )} x \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a b^{2} + b^{3}\right )} x \sinh \left (x\right )^{2} - 2 \, a^{2} b + 2 \, b^{3} +{\left (a b^{2} + b^{3}\right )} x -{\left (a^{3} \cosh \left (x\right )^{2} + 2 \, a^{3} \cosh \left (x\right ) \sinh \left (x\right ) + a^{3} \sinh \left (x\right )^{2} + a^{3}\right )} \log \left (\frac{2 \,{\left (a \cosh \left (x\right ) + b \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) +{\left (a^{3} - a b^{2} +{\left (a^{3} - a b^{2}\right )} \cosh \left (x\right )^{2} + 2 \,{\left (a^{3} - a b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a^{3} - a b^{2}\right )} \sinh \left (x\right )^{2}\right )} \log \left (\frac{2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{2} b^{2} - b^{4} +{\left (a^{2} b^{2} - b^{4}\right )} \cosh \left (x\right )^{2} + 2 \,{\left (a^{2} b^{2} - b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a^{2} b^{2} - b^{4}\right )} \sinh \left (x\right )^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-((a*b^2 + b^3)*x*cosh(x)^2 + 2*(a*b^2 + b^3)*x*cosh(x)*sinh(x) + (a*b^2 + b^3)*x*sinh(x)^2 - 2*a^2*b + 2*b^3
+ (a*b^2 + b^3)*x - (a^3*cosh(x)^2 + 2*a^3*cosh(x)*sinh(x) + a^3*sinh(x)^2 + a^3)*log(2*(a*cosh(x) + b*sinh(x)
)/(cosh(x) - sinh(x))) + (a^3 - a*b^2 + (a^3 - a*b^2)*cosh(x)^2 + 2*(a^3 - a*b^2)*cosh(x)*sinh(x) + (a^3 - a*b
^2)*sinh(x)^2)*log(2*cosh(x)/(cosh(x) - sinh(x))))/(a^2*b^2 - b^4 + (a^2*b^2 - b^4)*cosh(x)^2 + 2*(a^2*b^2 - b
^4)*cosh(x)*sinh(x) + (a^2*b^2 - b^4)*sinh(x)^2)

________________________________________________________________________________________

Sympy [A]  time = 1.3596, size = 330, normalized size = 5.16 \begin{align*} \begin{cases} \tilde{\infty } \left (x - \tanh{\left (x \right )}\right ) & \text{for}\: a = 0 \wedge b = 0 \\\frac{5 x \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} - \frac{5 x}{2 b \tanh{\left (x \right )} - 2 b} - \frac{2 \log{\left (\tanh{\left (x \right )} + 1 \right )} \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} + \frac{2 \log{\left (\tanh{\left (x \right )} + 1 \right )}}{2 b \tanh{\left (x \right )} - 2 b} - \frac{2 \tanh ^{2}{\left (x \right )}}{2 b \tanh{\left (x \right )} - 2 b} + \frac{3}{2 b \tanh{\left (x \right )} - 2 b} & \text{for}\: a = - b \\\frac{x \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} + 2 b} + \frac{x}{2 b \tanh{\left (x \right )} + 2 b} + \frac{2 \log{\left (\tanh{\left (x \right )} + 1 \right )} \tanh{\left (x \right )}}{2 b \tanh{\left (x \right )} + 2 b} + \frac{2 \log{\left (\tanh{\left (x \right )} + 1 \right )}}{2 b \tanh{\left (x \right )} + 2 b} - \frac{2 \tanh ^{2}{\left (x \right )}}{2 b \tanh{\left (x \right )} + 2 b} + \frac{3}{2 b \tanh{\left (x \right )} + 2 b} & \text{for}\: a = b \\\frac{x - \log{\left (\tanh{\left (x \right )} + 1 \right )} - \frac{\tanh ^{2}{\left (x \right )}}{2}}{a} & \text{for}\: b = 0 \\\frac{a^{3} \log{\left (\frac{a}{b} + \tanh{\left (x \right )} \right )}}{a^{2} b^{2} - b^{4}} - \frac{a^{2} b \tanh{\left (x \right )}}{a^{2} b^{2} - b^{4}} + \frac{a b^{2} x}{a^{2} b^{2} - b^{4}} - \frac{a b^{2} \log{\left (\tanh{\left (x \right )} + 1 \right )}}{a^{2} b^{2} - b^{4}} - \frac{b^{3} x}{a^{2} b^{2} - b^{4}} + \frac{b^{3} \tanh{\left (x \right )}}{a^{2} b^{2} - b^{4}} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(x)**3/(a+b*tanh(x)),x)

[Out]

Piecewise((zoo*(x - tanh(x)), Eq(a, 0) & Eq(b, 0)), (5*x*tanh(x)/(2*b*tanh(x) - 2*b) - 5*x/(2*b*tanh(x) - 2*b)
 - 2*log(tanh(x) + 1)*tanh(x)/(2*b*tanh(x) - 2*b) + 2*log(tanh(x) + 1)/(2*b*tanh(x) - 2*b) - 2*tanh(x)**2/(2*b
*tanh(x) - 2*b) + 3/(2*b*tanh(x) - 2*b), Eq(a, -b)), (x*tanh(x)/(2*b*tanh(x) + 2*b) + x/(2*b*tanh(x) + 2*b) +
2*log(tanh(x) + 1)*tanh(x)/(2*b*tanh(x) + 2*b) + 2*log(tanh(x) + 1)/(2*b*tanh(x) + 2*b) - 2*tanh(x)**2/(2*b*ta
nh(x) + 2*b) + 3/(2*b*tanh(x) + 2*b), Eq(a, b)), ((x - log(tanh(x) + 1) - tanh(x)**2/2)/a, Eq(b, 0)), (a**3*lo
g(a/b + tanh(x))/(a**2*b**2 - b**4) - a**2*b*tanh(x)/(a**2*b**2 - b**4) + a*b**2*x/(a**2*b**2 - b**4) - a*b**2
*log(tanh(x) + 1)/(a**2*b**2 - b**4) - b**3*x/(a**2*b**2 - b**4) + b**3*tanh(x)/(a**2*b**2 - b**4), True))

________________________________________________________________________________________

Giac [A]  time = 1.20419, size = 101, normalized size = 1.58 \begin{align*} \frac{a^{3} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{2} b^{2} - b^{4}} - \frac{x}{a - b} - \frac{a \log \left (e^{\left (2 \, x\right )} + 1\right )}{b^{2}} + \frac{2}{b{\left (e^{\left (2 \, x\right )} + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

a^3*log(abs(a*e^(2*x) + b*e^(2*x) + a - b))/(a^2*b^2 - b^4) - x/(a - b) - a*log(e^(2*x) + 1)/b^2 + 2/(b*(e^(2*
x) + 1))