3.7.16 \(\int (a \text {sech}(x)+b \tanh (x))^3 \, dx\) [616]

3.7.16.1 Optimal result
3.7.16.2 Mathematica [B] (verified)
3.7.16.3 Rubi [A] (verified)
3.7.16.4 Maple [A] (verified)
3.7.16.5 Fricas [B] (verification not implemented)
3.7.16.6 Sympy [F]
3.7.16.7 Maxima [B] (verification not implemented)
3.7.16.8 Giac [B] (verification not implemented)
3.7.16.9 Mupad [B] (verification not implemented)

3.7.16.1 Optimal result

Integrand size = 11, antiderivative size = 58 \[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=\frac {1}{2} a \left (a^2+3 b^2\right ) \arctan (\sinh (x))+b^3 \log (\cosh (x))-\frac {1}{2} a b^2 \sinh (x)-\frac {1}{2} \text {sech}^2(x) (b-a \sinh (x)) (a+b \sinh (x))^2 \]

output
1/2*a*(a^2+3*b^2)*arctan(sinh(x))+b^3*ln(cosh(x))-1/2*a*b^2*sinh(x)-1/2*se 
ch(x)^2*(b-a*sinh(x))*(a+b*sinh(x))^2
 
3.7.16.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(194\) vs. \(2(58)=116\).

Time = 1.30 (sec) , antiderivative size = 194, normalized size of antiderivative = 3.34 \[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=\frac {1}{4} \left (\frac {b \left (\left (a^3+3 a b^2-2 \left (-b^2\right )^{3/2}\right ) \log \left (\sqrt {-b^2}-b \sinh (x)\right )-\left (a^3+3 a b^2+2 \left (-b^2\right )^{3/2}\right ) \log \left (\sqrt {-b^2}+b \sinh (x)\right )\right )}{\sqrt {-b^2}}+\frac {2 a^4 b \text {sech}^2(x)}{a^2+b^2}+\frac {a \left (2 a^4-4 a^2 b^2-7 b^4+b^4 \cosh (2 x)\right ) \text {sech}(x) \tanh (x)}{a^2+b^2}-\frac {2 b \left (-4 a^4-2 a^2 b^2+b^4+a b^3 \sinh (x)\right ) \tanh ^2(x)}{a^2+b^2}\right ) \]

input
Integrate[(a*Sech[x] + b*Tanh[x])^3,x]
 
output
((b*((a^3 + 3*a*b^2 - 2*(-b^2)^(3/2))*Log[Sqrt[-b^2] - b*Sinh[x]] - (a^3 + 
 3*a*b^2 + 2*(-b^2)^(3/2))*Log[Sqrt[-b^2] + b*Sinh[x]]))/Sqrt[-b^2] + (2*a 
^4*b*Sech[x]^2)/(a^2 + b^2) + (a*(2*a^4 - 4*a^2*b^2 - 7*b^4 + b^4*Cosh[2*x 
])*Sech[x]*Tanh[x])/(a^2 + b^2) - (2*b*(-4*a^4 - 2*a^2*b^2 + b^4 + a*b^3*S 
inh[x])*Tanh[x]^2)/(a^2 + b^2))/4
 
3.7.16.3 Rubi [A] (verified)

Time = 0.35 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.59, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.636, Rules used = {3042, 4891, 3042, 3147, 495, 657, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a \text {sech}(x)+b \tanh (x))^3 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a \sec (i x)-i b \tan (i x))^3dx\)

\(\Big \downarrow \) 4891

\(\displaystyle \int \text {sech}^3(x) (a+b \sinh (x))^3dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a-i b \sin (i x))^3}{\cos (i x)^3}dx\)

\(\Big \downarrow \) 3147

\(\displaystyle b^3 \int \frac {(a+b \sinh (x))^3}{\left (\sinh ^2(x) b^2+b^2\right )^2}d(b \sinh (x))\)

\(\Big \downarrow \) 495

\(\displaystyle b^3 \left (\frac {\int \frac {(a+b \sinh (x)) \left (a^2-b \sinh (x) a+2 b^2\right )}{\sinh ^2(x) b^2+b^2}d(b \sinh (x))}{2 b^2}-\frac {(a+b \sinh (x))^2 \left (b^2-a b \sinh (x)\right )}{2 b^2 \left (b^2 \sinh ^2(x)+b^2\right )}\right )\)

\(\Big \downarrow \) 657

\(\displaystyle b^3 \left (\frac {\int \left (\frac {a^3+3 b^2 a+2 b^3 \sinh (x)}{\sinh ^2(x) b^2+b^2}-a\right )d(b \sinh (x))}{2 b^2}-\frac {(a+b \sinh (x))^2 \left (b^2-a b \sinh (x)\right )}{2 b^2 \left (b^2 \sinh ^2(x)+b^2\right )}\right )\)

\(\Big \downarrow \) 2009

\(\displaystyle b^3 \left (\frac {\frac {a \left (a^2+3 b^2\right ) \arctan (\sinh (x))}{b}-a b \sinh (x)+b^2 \log \left (b^2 \sinh ^2(x)+b^2\right )}{2 b^2}-\frac {(a+b \sinh (x))^2 \left (b^2-a b \sinh (x)\right )}{2 b^2 \left (b^2 \sinh ^2(x)+b^2\right )}\right )\)

input
Int[(a*Sech[x] + b*Tanh[x])^3,x]
 
output
b^3*(((a*(a^2 + 3*b^2)*ArcTan[Sinh[x]])/b + b^2*Log[b^2 + b^2*Sinh[x]^2] - 
 a*b*Sinh[x])/(2*b^2) - ((a + b*Sinh[x])^2*(b^2 - a*b*Sinh[x]))/(2*b^2*(b^ 
2 + b^2*Sinh[x]^2)))
 

3.7.16.3.1 Defintions of rubi rules used

rule 495
Int[((c_) + (d_.)*(x_))^(n_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[ 
(a*d - b*c*x)*(c + d*x)^(n - 1)*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] - 
 Simp[1/(2*a*b*(p + 1))   Int[(c + d*x)^(n - 2)*(a + b*x^2)^(p + 1)*Simp[a* 
d^2*(n - 1) - b*c^2*(2*p + 3) - b*c*d*(n + 2*p + 2)*x, x], x], x] /; FreeQ[ 
{a, b, c, d}, x] && LtQ[p, -1] && GtQ[n, 1] && IntQuadraticQ[a, 0, b, c, d, 
 n, p, x]
 

rule 657
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( 
x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 
2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3147
Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m 
_.), x_Symbol] :> Simp[1/(b^p*f)   Subst[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] && IntegerQ[(p 
 - 1)/2] && NeQ[a^2 - b^2, 0]
 

rule 4891
Int[(u_.)*((b_.)*sec[(c_.) + (d_.)*(x_)]^(n_.) + (a_.)*tan[(c_.) + (d_.)*(x 
_)]^(n_.))^(p_), x_Symbol] :> Int[ActivateTrig[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]
 
3.7.16.4 Maple [A] (verified)

Time = 13.14 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.10

method result size
default \(a^{3} \left (\frac {\operatorname {sech}\left (x \right ) \tanh \left (x \right )}{2}+\arctan \left ({\mathrm e}^{x}\right )\right )-\frac {3 a^{2} b}{2 \cosh \left (x \right )^{2}}+3 a \,b^{2} \left (-\frac {\sinh \left (x \right )}{\cosh \left (x \right )^{2}}+\frac {\operatorname {sech}\left (x \right ) \tanh \left (x \right )}{2}+\arctan \left ({\mathrm e}^{x}\right )\right )+b^{3} \left (\ln \left (\cosh \left (x \right )\right )-\frac {\tanh \left (x \right )^{2}}{2}\right )\) \(64\)
parts \(a^{3} \left (\frac {\operatorname {sech}\left (x \right ) \tanh \left (x \right )}{2}+\arctan \left ({\mathrm e}^{x}\right )\right )+b^{3} \left (-\frac {\tanh \left (x \right )^{2}}{2}-\frac {\ln \left (\tanh \left (x \right )-1\right )}{2}-\frac {\ln \left (1+\tanh \left (x \right )\right )}{2}\right )+3 a \,b^{2} \left (-\frac {\sinh \left (x \right )}{\cosh \left (x \right )^{2}}+\frac {\operatorname {sech}\left (x \right ) \tanh \left (x \right )}{2}+\arctan \left ({\mathrm e}^{x}\right )\right )+\frac {3 a^{2} b \tanh \left (x \right )^{2}}{2}\) \(75\)
risch \(-b^{3} x +\frac {{\mathrm e}^{x} \left (a^{3} {\mathrm e}^{2 x}-3 a \,b^{2} {\mathrm e}^{2 x}-6 a^{2} b \,{\mathrm e}^{x}+2 b^{3} {\mathrm e}^{x}-a^{3}+3 a \,b^{2}\right )}{\left (1+{\mathrm e}^{2 x}\right )^{2}}+\frac {i \ln \left ({\mathrm e}^{x}+i\right ) a^{3}}{2}+\frac {3 i \ln \left ({\mathrm e}^{x}+i\right ) a \,b^{2}}{2}+\ln \left ({\mathrm e}^{x}+i\right ) b^{3}-\frac {i \ln \left ({\mathrm e}^{x}-i\right ) a^{3}}{2}-\frac {3 i \ln \left ({\mathrm e}^{x}-i\right ) a \,b^{2}}{2}+\ln \left ({\mathrm e}^{x}-i\right ) b^{3}\) \(134\)

input
int((a*sech(x)+b*tanh(x))^3,x,method=_RETURNVERBOSE)
 
output
a^3*(1/2*sech(x)*tanh(x)+arctan(exp(x)))-3/2*a^2*b/cosh(x)^2+3*a*b^2*(-1/c 
osh(x)^2*sinh(x)+1/2*sech(x)*tanh(x)+arctan(exp(x)))+b^3*(ln(cosh(x))-1/2* 
tanh(x)^2)
 
3.7.16.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 502 vs. \(2 (53) = 106\).

Time = 0.27 (sec) , antiderivative size = 502, normalized size of antiderivative = 8.66 \[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=-\frac {b^{3} x \cosh \left (x\right )^{4} + b^{3} x \sinh \left (x\right )^{4} + b^{3} x - {\left (a^{3} - 3 \, a b^{2}\right )} \cosh \left (x\right )^{3} + {\left (4 \, b^{3} x \cosh \left (x\right ) - a^{3} + 3 \, a b^{2}\right )} \sinh \left (x\right )^{3} + 2 \, {\left (b^{3} x + 3 \, a^{2} b - b^{3}\right )} \cosh \left (x\right )^{2} + {\left (6 \, b^{3} x \cosh \left (x\right )^{2} + 2 \, b^{3} x + 6 \, a^{2} b - 2 \, b^{3} - 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{2} - {\left ({\left (a^{3} + 3 \, a b^{2}\right )} \cosh \left (x\right )^{4} + 4 \, {\left (a^{3} + 3 \, a b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (a^{3} + 3 \, a b^{2}\right )} \sinh \left (x\right )^{4} + a^{3} + 3 \, a b^{2} + 2 \, {\left (a^{3} + 3 \, a b^{2}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a^{3} + 3 \, a b^{2} + 3 \, {\left (a^{3} + 3 \, a b^{2}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )^{2} + 4 \, {\left ({\left (a^{3} + 3 \, a b^{2}\right )} \cosh \left (x\right )^{3} + {\left (a^{3} + 3 \, a b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) + {\left (a^{3} - 3 \, a b^{2}\right )} \cosh \left (x\right ) - {\left (b^{3} \cosh \left (x\right )^{4} + 4 \, b^{3} \cosh \left (x\right ) \sinh \left (x\right )^{3} + b^{3} \sinh \left (x\right )^{4} + 2 \, b^{3} \cosh \left (x\right )^{2} + b^{3} + 2 \, {\left (3 \, b^{3} \cosh \left (x\right )^{2} + b^{3}\right )} \sinh \left (x\right )^{2} + 4 \, {\left (b^{3} \cosh \left (x\right )^{3} + b^{3} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + {\left (4 \, b^{3} x \cosh \left (x\right )^{3} + a^{3} - 3 \, a b^{2} - 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} \cosh \left (x\right )^{2} + 4 \, {\left (b^{3} x + 3 \, a^{2} b - b^{3}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}{\cosh \left (x\right )^{4} + 4 \, \cosh \left (x\right ) \sinh \left (x\right )^{3} + \sinh \left (x\right )^{4} + 2 \, {\left (3 \, \cosh \left (x\right )^{2} + 1\right )} \sinh \left (x\right )^{2} + 2 \, \cosh \left (x\right )^{2} + 4 \, {\left (\cosh \left (x\right )^{3} + \cosh \left (x\right )\right )} \sinh \left (x\right ) + 1} \]

input
integrate((a*sech(x)+b*tanh(x))^3,x, algorithm="fricas")
 
output
-(b^3*x*cosh(x)^4 + b^3*x*sinh(x)^4 + b^3*x - (a^3 - 3*a*b^2)*cosh(x)^3 + 
(4*b^3*x*cosh(x) - a^3 + 3*a*b^2)*sinh(x)^3 + 2*(b^3*x + 3*a^2*b - b^3)*co 
sh(x)^2 + (6*b^3*x*cosh(x)^2 + 2*b^3*x + 6*a^2*b - 2*b^3 - 3*(a^3 - 3*a*b^ 
2)*cosh(x))*sinh(x)^2 - ((a^3 + 3*a*b^2)*cosh(x)^4 + 4*(a^3 + 3*a*b^2)*cos 
h(x)*sinh(x)^3 + (a^3 + 3*a*b^2)*sinh(x)^4 + a^3 + 3*a*b^2 + 2*(a^3 + 3*a* 
b^2)*cosh(x)^2 + 2*(a^3 + 3*a*b^2 + 3*(a^3 + 3*a*b^2)*cosh(x)^2)*sinh(x)^2 
 + 4*((a^3 + 3*a*b^2)*cosh(x)^3 + (a^3 + 3*a*b^2)*cosh(x))*sinh(x))*arctan 
(cosh(x) + sinh(x)) + (a^3 - 3*a*b^2)*cosh(x) - (b^3*cosh(x)^4 + 4*b^3*cos 
h(x)*sinh(x)^3 + b^3*sinh(x)^4 + 2*b^3*cosh(x)^2 + b^3 + 2*(3*b^3*cosh(x)^ 
2 + b^3)*sinh(x)^2 + 4*(b^3*cosh(x)^3 + b^3*cosh(x))*sinh(x))*log(2*cosh(x 
)/(cosh(x) - sinh(x))) + (4*b^3*x*cosh(x)^3 + a^3 - 3*a*b^2 - 3*(a^3 - 3*a 
*b^2)*cosh(x)^2 + 4*(b^3*x + 3*a^2*b - b^3)*cosh(x))*sinh(x))/(cosh(x)^4 + 
 4*cosh(x)*sinh(x)^3 + sinh(x)^4 + 2*(3*cosh(x)^2 + 1)*sinh(x)^2 + 2*cosh( 
x)^2 + 4*(cosh(x)^3 + cosh(x))*sinh(x) + 1)
 
3.7.16.6 Sympy [F]

\[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=\int \left (a \operatorname {sech}{\left (x \right )} + b \tanh {\left (x \right )}\right )^{3}\, dx \]

input
integrate((a*sech(x)+b*tanh(x))**3,x)
 
output
Integral((a*sech(x) + b*tanh(x))**3, x)
 
3.7.16.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 120 vs. \(2 (53) = 106\).

Time = 0.28 (sec) , antiderivative size = 120, normalized size of antiderivative = 2.07 \[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=\frac {3}{2} \, a^{2} b \tanh \left (x\right )^{2} + b^{3} {\left (x + \frac {2 \, e^{\left (-2 \, x\right )}}{2 \, e^{\left (-2 \, x\right )} + e^{\left (-4 \, x\right )} + 1} + \log \left (e^{\left (-2 \, x\right )} + 1\right )\right )} - 3 \, a b^{2} {\left (\frac {e^{\left (-x\right )} - e^{\left (-3 \, x\right )}}{2 \, e^{\left (-2 \, x\right )} + e^{\left (-4 \, x\right )} + 1} + \arctan \left (e^{\left (-x\right )}\right )\right )} + a^{3} {\left (\frac {e^{\left (-x\right )} - e^{\left (-3 \, x\right )}}{2 \, e^{\left (-2 \, x\right )} + e^{\left (-4 \, x\right )} + 1} - \arctan \left (e^{\left (-x\right )}\right )\right )} \]

input
integrate((a*sech(x)+b*tanh(x))^3,x, algorithm="maxima")
 
output
3/2*a^2*b*tanh(x)^2 + b^3*(x + 2*e^(-2*x)/(2*e^(-2*x) + e^(-4*x) + 1) + lo 
g(e^(-2*x) + 1)) - 3*a*b^2*((e^(-x) - e^(-3*x))/(2*e^(-2*x) + e^(-4*x) + 1 
) + arctan(e^(-x))) + a^3*((e^(-x) - e^(-3*x))/(2*e^(-2*x) + e^(-4*x) + 1) 
 - arctan(e^(-x)))
 
3.7.16.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (53) = 106\).

Time = 0.26 (sec) , antiderivative size = 117, normalized size of antiderivative = 2.02 \[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=\frac {1}{2} \, b^{3} \log \left ({\left (e^{\left (-x\right )} - e^{x}\right )}^{2} + 4\right ) + \frac {1}{4} \, {\left (\pi + 2 \, \arctan \left (\frac {1}{2} \, {\left (e^{\left (2 \, x\right )} - 1\right )} e^{\left (-x\right )}\right )\right )} {\left (a^{3} + 3 \, a b^{2}\right )} - \frac {b^{3} {\left (e^{\left (-x\right )} - e^{x}\right )}^{2} + 2 \, a^{3} {\left (e^{\left (-x\right )} - e^{x}\right )} - 6 \, a b^{2} {\left (e^{\left (-x\right )} - e^{x}\right )} + 12 \, a^{2} b}{2 \, {\left ({\left (e^{\left (-x\right )} - e^{x}\right )}^{2} + 4\right )}} \]

input
integrate((a*sech(x)+b*tanh(x))^3,x, algorithm="giac")
 
output
1/2*b^3*log((e^(-x) - e^x)^2 + 4) + 1/4*(pi + 2*arctan(1/2*(e^(2*x) - 1)*e 
^(-x)))*(a^3 + 3*a*b^2) - 1/2*(b^3*(e^(-x) - e^x)^2 + 2*a^3*(e^(-x) - e^x) 
 - 6*a*b^2*(e^(-x) - e^x) + 12*a^2*b)/((e^(-x) - e^x)^2 + 4)
 
3.7.16.9 Mupad [B] (verification not implemented)

Time = 2.51 (sec) , antiderivative size = 233, normalized size of antiderivative = 4.02 \[ \int (a \text {sech}(x)+b \tanh (x))^3 \, dx=\mathrm {atan}\left (\frac {{\mathrm {e}}^x\,\left (a^3+3\,a\,b^2\right )}{\sqrt {a^6+6\,a^4\,b^2+9\,a^2\,b^4}}\right )\,\sqrt {a^6+6\,a^4\,b^2+9\,a^2\,b^4}+\frac {{\mathrm {e}}^x\,\left (6\,a\,b^2-2\,a^3\right )+6\,a^2\,b-2\,b^3}{2\,{\mathrm {e}}^{2\,x}+{\mathrm {e}}^{4\,x}+1}+b^3\,\ln \left (\left (a^3\,{\mathrm {e}}^x-2\,\sqrt {-\frac {a^6}{4}-\frac {3\,a^4\,b^2}{2}-\frac {9\,a^2\,b^4}{4}}+3\,a\,b^2\,{\mathrm {e}}^x\right )\,\left (2\,\sqrt {-\frac {a^6}{4}-\frac {3\,a^4\,b^2}{2}-\frac {9\,a^2\,b^4}{4}}+a^3\,{\mathrm {e}}^x+3\,a\,b^2\,{\mathrm {e}}^x\right )\right )-b^3\,x-\frac {{\mathrm {e}}^x\,\left (3\,a\,b^2-a^3\right )+6\,a^2\,b-2\,b^3}{{\mathrm {e}}^{2\,x}+1} \]

input
int((b*tanh(x) + a/cosh(x))^3,x)
 
output
atan((exp(x)*(3*a*b^2 + a^3))/(a^6 + 9*a^2*b^4 + 6*a^4*b^2)^(1/2))*(a^6 + 
9*a^2*b^4 + 6*a^4*b^2)^(1/2) + (exp(x)*(6*a*b^2 - 2*a^3) + 6*a^2*b - 2*b^3 
)/(2*exp(2*x) + exp(4*x) + 1) + b^3*log((a^3*exp(x) - 2*(- a^6/4 - (9*a^2* 
b^4)/4 - (3*a^4*b^2)/2)^(1/2) + 3*a*b^2*exp(x))*(2*(- a^6/4 - (9*a^2*b^4)/ 
4 - (3*a^4*b^2)/2)^(1/2) + a^3*exp(x) + 3*a*b^2*exp(x))) - b^3*x - (exp(x) 
*(3*a*b^2 - a^3) + 6*a^2*b - 2*b^3)/(exp(2*x) + 1)