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

Optimal. Leaf size=58 $\frac{1}{2} a \left (a^2+3 b^2\right ) \tan ^{-1}(\sinh (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+b^3 \log (\cosh (x))$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.106695, antiderivative size = 58, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 7, integrand size = 11, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.636, Rules used = {4391, 2668, 739, 774, 635, 204, 260} $\frac{1}{2} a \left (a^2+3 b^2\right ) \tan ^{-1}(\sinh (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+b^3 \log (\cosh (x))$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 4391

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]

Rule 2668

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 739

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((d + e*x)^(m - 1)*(a*e - c*d*x)*(a
+ c*x^2)^(p + 1))/(2*a*c*(p + 1)), x] + Dist[1/((p + 1)*(-2*a*c)), Int[(d + e*x)^(m - 2)*Simp[a*e^2*(m - 1) -
c*d^2*(2*p + 3) - d*c*e*(m + 2*p + 2)*x, x]*(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x] && NeQ[c*d^
2 + a*e^2, 0] && LtQ[p, -1] && GtQ[m, 1] && IntQuadraticQ[a, 0, c, d, e, m, p, x]

Rule 774

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

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 204

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

Rule 260

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

Rubi steps

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

Mathematica [B]  time = 1.86863, size = 194, normalized size = 3.34 $\frac{1}{4} \left (\frac{2 a^4 b \text{sech}^2(x)}{a^2+b^2}+\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 b \tanh ^2(x) \left (-2 a^2 b^2-4 a^4+a b^3 \sinh (x)+b^4\right )}{a^2+b^2}+\frac{a \tanh (x) \text{sech}(x) \left (-4 a^2 b^2+2 a^4+b^4 \cosh (2 x)-7 b^4\right )}{a^2+b^2}\right )$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

((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*Sinh[x])*Tanh[x]^2)/(a^2 + b^2))/4

________________________________________________________________________________________

Maple [A]  time = 0.03, size = 79, normalized size = 1.4 \begin{align*}{\frac{{a}^{3}{\rm sech} \left (x\right )\tanh \left ( x \right ) }{2}}+{a}^{3}\arctan \left ({{\rm e}^{x}} \right ) +{\frac{3\,{a}^{2}b \left ( \sinh \left ( x \right ) \right ) ^{2}}{2\, \left ( \cosh \left ( x \right ) \right ) ^{2}}}-3\,{\frac{a{b}^{2}\sinh \left ( x \right ) }{ \left ( \cosh \left ( x \right ) \right ) ^{2}}}+{\frac{3\,a{b}^{2}{\rm sech} \left (x\right )\tanh \left ( x \right ) }{2}}+3\,a{b}^{2}\arctan \left ({{\rm e}^{x}} \right ) +{b}^{3}\ln \left ( \cosh \left ( x \right ) \right ) -{\frac{{b}^{3} \left ( \tanh \left ( x \right ) \right ) ^{2}}{2}} \end{align*}

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

[In]

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

[Out]

1/2*a^3*sech(x)*tanh(x)+a^3*arctan(exp(x))+3/2*a^2*b*sinh(x)^2/cosh(x)^2-3*a*b^2/cosh(x)^2*sinh(x)+3/2*a*b^2*s
ech(x)*tanh(x)+3*a*b^2*arctan(exp(x))+b^3*ln(cosh(x))-1/2*b^3*tanh(x)^2

________________________________________________________________________________________

Maxima [B]  time = 1.57354, size = 162, normalized size = 2.79 \begin{align*} \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 )} \end{align*}

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

[In]

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

[Out]

3/2*a^2*b*tanh(x)^2 + b^3*(x + 2*e^(-2*x)/(2*e^(-2*x) + e^(-4*x) + 1) + log(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)))

________________________________________________________________________________________

Fricas [B]  time = 2.47664, size = 1359, normalized size = 23.43 \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

-(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)*si
nh(x)^3 + 2*(b^3*x + 3*a^2*b - b^3)*cosh(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)*cosh(x)*sinh(x)^3 + (a^3 + 3*a*b^2)*s
inh(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*cosh(x)*sinh(x)^3 + b^3*sinh(x)^4 + 2*b^3*cosh(x)^2 + b^3 + 2*(3*b^3*co
sh(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))/(cos
h(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)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a \operatorname{sech}{\left (x \right )} + b \tanh{\left (x \right )}\right )^{3}\, dx \end{align*}

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

[In]

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

[Out]

Integral((a*sech(x) + b*tanh(x))**3, x)

________________________________________________________________________________________

Giac [B]  time = 1.14454, size = 158, normalized size = 2.72 \begin{align*} \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 )}} \end{align*}

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

[In]

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

[Out]

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)