3.7.21 \(\int \frac {1}{(a \text {sech}(x)+b \tanh (x))^3} \, dx\) [621]

Optimal. Leaf size=48 \[ \frac {\log (a+b \sinh (x))}{b^3}-\frac {a^2+b^2}{2 b^3 (a+b \sinh (x))^2}+\frac {2 a}{b^3 (a+b \sinh (x))} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {4476, 2747, 711} \begin {gather*} -\frac {a^2+b^2}{2 b^3 (a+b \sinh (x))^2}+\frac {2 a}{b^3 (a+b \sinh (x))}+\frac {\log (a+b \sinh (x))}{b^3} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 711

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*(a + c*
x^2)^p, x], x] /; FreeQ[{a, c, d, e, m}, x] && NeQ[c*d^2 + a*e^2, 0] && IGtQ[p, 0]

Rule 2747

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^m*(b^2 - x^2)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && Integer
Q[(p - 1)/2] && NeQ[a^2 - b^2, 0]

Rule 4476

Int[(u_.)*((b_.)*sec[(c_.) + (d_.)*(x_)]^(n_.) + (a_.)*tan[(c_.) + (d_.)*(x_)]^(n_.))^(p_), x_Symbol] :> Int[A
ctivateTrig[u]*Sec[c + d*x]^(n*p)*(b + a*Sin[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.09, size = 80, normalized size = 1.67 \begin {gather*} \frac {3 a^2-b^2+2 a^2 \log (a+b \sinh (x))-b^2 \log (a+b \sinh (x))+b^2 \cosh (2 x) \log (a+b \sinh (x))+4 a b (1+\log (a+b \sinh (x))) \sinh (x)}{2 b^3 (a+b \sinh (x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(140\) vs. \(2(50)=100\).
time = 1.22, size = 141, normalized size = 2.94

method result size
risch \(-\frac {x}{b^{3}}+\frac {2 \,{\mathrm e}^{x} \left (2 a b \,{\mathrm e}^{2 x}+3 a^{2} {\mathrm e}^{x}-b^{2} {\mathrm e}^{x}-2 a b \right )}{b^{3} \left (b \,{\mathrm e}^{2 x}+2 a \,{\mathrm e}^{x}-b \right )^{2}}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {2 a \,{\mathrm e}^{x}}{b}-1\right )}{b^{3}}\) \(78\)
default \(\frac {\frac {2 \left (\frac {b \left (a^{2}-b^{2}\right ) \left (\tanh ^{3}\left (\frac {x}{2}\right )\right )}{a}-\frac {b^{2} \left (3 a^{2}-b^{2}\right ) \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )}{a^{2}}-\frac {b \left (a^{2}-b^{2}\right ) \tanh \left (\frac {x}{2}\right )}{a}\right )}{\left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 b \tanh \left (\frac {x}{2}\right )-a \right )^{2}}+\ln \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 b \tanh \left (\frac {x}{2}\right )-a \right )}{b^{3}}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{b^{3}}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{b^{3}}\) \(141\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a*sech(x)+b*tanh(x))^3,x,method=_RETURNVERBOSE)

[Out]

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

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (46) = 92\).
time = 0.29, size = 117, normalized size = 2.44 \begin {gather*} \frac {2 \, {\left (2 \, a b e^{\left (-x\right )} - 2 \, a b e^{\left (-3 \, x\right )} + {\left (3 \, a^{2} - b^{2}\right )} e^{\left (-2 \, x\right )}\right )}}{4 \, a b^{4} e^{\left (-x\right )} - 4 \, a b^{4} e^{\left (-3 \, x\right )} + b^{5} e^{\left (-4 \, x\right )} + b^{5} + 2 \, {\left (2 \, a^{2} b^{3} - b^{5}\right )} e^{\left (-2 \, x\right )}} + \frac {x}{b^{3}} + \frac {\log \left (-2 \, a e^{\left (-x\right )} + b e^{\left (-2 \, x\right )} - b\right )}{b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 543 vs. \(2 (46) = 92\).
time = 0.43, size = 543, normalized size = 11.31 \begin {gather*} -\frac {b^{2} x \cosh \left (x\right )^{4} + b^{2} x \sinh \left (x\right )^{4} + 4 \, {\left (a b x - a b\right )} \cosh \left (x\right )^{3} + 4 \, {\left (b^{2} x \cosh \left (x\right ) + a b x - a b\right )} \sinh \left (x\right )^{3} + b^{2} x - 2 \, {\left (3 \, a^{2} - b^{2} - {\left (2 \, a^{2} - b^{2}\right )} x\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, b^{2} x \cosh \left (x\right )^{2} - 3 \, a^{2} + b^{2} + {\left (2 \, a^{2} - b^{2}\right )} x + 6 \, {\left (a b x - a b\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{2} - 4 \, {\left (a b x - a b\right )} \cosh \left (x\right ) - {\left (b^{2} \cosh \left (x\right )^{4} + b^{2} \sinh \left (x\right )^{4} + 4 \, a b \cosh \left (x\right )^{3} + 4 \, {\left (b^{2} \cosh \left (x\right ) + a b\right )} \sinh \left (x\right )^{3} - 4 \, a b \cosh \left (x\right ) + 2 \, {\left (2 \, a^{2} - b^{2}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, b^{2} \cosh \left (x\right )^{2} + 6 \, a b \cosh \left (x\right ) + 2 \, a^{2} - b^{2}\right )} \sinh \left (x\right )^{2} + b^{2} + 4 \, {\left (b^{2} \cosh \left (x\right )^{3} + 3 \, a b \cosh \left (x\right )^{2} - a b + {\left (2 \, a^{2} - b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, {\left (b \sinh \left (x\right ) + a\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 4 \, {\left (b^{2} x \cosh \left (x\right )^{3} - a b x + 3 \, {\left (a b x - a b\right )} \cosh \left (x\right )^{2} + a b - {\left (3 \, a^{2} - b^{2} - {\left (2 \, a^{2} - b^{2}\right )} x\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}{b^{5} \cosh \left (x\right )^{4} + b^{5} \sinh \left (x\right )^{4} + 4 \, a b^{4} \cosh \left (x\right )^{3} - 4 \, a b^{4} \cosh \left (x\right ) + b^{5} + 4 \, {\left (b^{5} \cosh \left (x\right ) + a b^{4}\right )} \sinh \left (x\right )^{3} + 2 \, {\left (2 \, a^{2} b^{3} - b^{5}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, b^{5} \cosh \left (x\right )^{2} + 6 \, a b^{4} \cosh \left (x\right ) + 2 \, a^{2} b^{3} - b^{5}\right )} \sinh \left (x\right )^{2} + 4 \, {\left (b^{5} \cosh \left (x\right )^{3} + 3 \, a b^{4} \cosh \left (x\right )^{2} - a b^{4} + {\left (2 \, a^{2} b^{3} - b^{5}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 651 vs. \(2 (48) = 96\).
time = 1.30, size = 651, normalized size = 13.56 \begin {gather*} \begin {cases} \frac {2 a^{2} x \operatorname {sech}^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} + \frac {2 a^{2} \log {\left (\frac {a \operatorname {sech}{\left (x \right )}}{b} + \tanh {\left (x \right )} \right )} \operatorname {sech}^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} - \frac {2 a^{2} \log {\left (\tanh {\left (x \right )} + 1 \right )} \operatorname {sech}^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} + \frac {a^{2} \operatorname {sech}^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} + \frac {4 a b x \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} + \frac {4 a b \log {\left (\frac {a \operatorname {sech}{\left (x \right )}}{b} + \tanh {\left (x \right )} \right )} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} - \frac {4 a b \log {\left (\tanh {\left (x \right )} + 1 \right )} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} + \frac {2 b^{2} x \tanh ^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} + \frac {2 b^{2} \log {\left (\frac {a \operatorname {sech}{\left (x \right )}}{b} + \tanh {\left (x \right )} \right )} \tanh ^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} - \frac {2 b^{2} \log {\left (\tanh {\left (x \right )} + 1 \right )} \tanh ^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} - \frac {b^{2} \tanh ^{2}{\left (x \right )}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} - \frac {b^{2}}{2 a^{2} b^{3} \operatorname {sech}^{2}{\left (x \right )} + 4 a b^{4} \tanh {\left (x \right )} \operatorname {sech}{\left (x \right )} + 2 b^{5} \tanh ^{2}{\left (x \right )}} & \text {for}\: b \neq 0 \\\frac {- \frac {2 \tanh ^{3}{\left (x \right )}}{3 \operatorname {sech}^{3}{\left (x \right )}} + \frac {\tanh {\left (x \right )}}{\operatorname {sech}^{3}{\left (x \right )}}}{a^{3}} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Piecewise((2*a**2*x*sech(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) + 2*a**
2*log(a*sech(x)/b + tanh(x))*sech(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2
) - 2*a**2*log(tanh(x) + 1)*sech(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2)
 + a**2*sech(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) + 4*a*b*x*tanh(x)*s
ech(x)/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) + 4*a*b*log(a*sech(x)/b + tanh(
x))*tanh(x)*sech(x)/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) - 4*a*b*log(tanh(x
) + 1)*tanh(x)*sech(x)/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) + 2*b**2*x*tanh
(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) + 2*b**2*log(a*sech(x)/b + tanh
(x))*tanh(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) - 2*b**2*log(tanh(x) +
 1)*tanh(x)**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) - b**2*tanh(x)**2/(2*a*
*2*b**3*sech(x)**2 + 4*a*b**4*tanh(x)*sech(x) + 2*b**5*tanh(x)**2) - b**2/(2*a**2*b**3*sech(x)**2 + 4*a*b**4*t
anh(x)*sech(x) + 2*b**5*tanh(x)**2), Ne(b, 0)), ((-2*tanh(x)**3/(3*sech(x)**3) + tanh(x)/sech(x)**3)/a**3, Tru
e))

________________________________________________________________________________________

Giac [A]
time = 0.43, size = 75, normalized size = 1.56 \begin {gather*} \frac {\log \left ({\left | -b {\left (e^{\left (-x\right )} - e^{x}\right )} + 2 \, a \right |}\right )}{b^{3}} - \frac {3 \, b {\left (e^{\left (-x\right )} - e^{x}\right )}^{2} - 4 \, a {\left (e^{\left (-x\right )} - e^{x}\right )} + 4 \, b}{2 \, {\left (b {\left (e^{\left (-x\right )} - e^{x}\right )} - 2 \, a\right )}^{2} b^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {1}{{\left (b\,\mathrm {tanh}\left (x\right )+\frac {a}{\mathrm {cosh}\left (x\right )}\right )}^3} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________