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

Optimal. Leaf size=100 $-\frac{4}{3} a b \left (a^2+2 b^2\right ) \cosh (x)-\frac{1}{3} b^2 \left (2 a^2+3 b^2\right ) \sinh (x) \cosh (x)+\frac{1}{3} \text{sech}(x) (a+b \sinh (x))^2 \left (\left (2 a^2+3 b^2\right ) \sinh (x)+a b\right )-\frac{1}{3} \text{sech}^3(x) (b-a \sinh (x)) (a+b \sinh (x))^3+b^4 x$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.208518, antiderivative size = 100, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 11, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.364, Rules used = {4391, 2691, 2861, 2734} $-\frac{4}{3} a b \left (a^2+2 b^2\right ) \cosh (x)-\frac{1}{3} b^2 \left (2 a^2+3 b^2\right ) \sinh (x) \cosh (x)+\frac{1}{3} \text{sech}(x) (a+b \sinh (x))^2 \left (\left (2 a^2+3 b^2\right ) \sinh (x)+a b\right )-\frac{1}{3} \text{sech}^3(x) (b-a \sinh (x)) (a+b \sinh (x))^3+b^4 x$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

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 2691

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> -Simp[((g*C
os[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^(m - 1)*(b + a*Sin[e + f*x]))/(f*g*(p + 1)), x] + Dist[1/(g^2*(p + 1
)), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^(m - 2)*(b^2*(m - 1) + a^2*(p + 2) + a*b*(m + p + 1)*Sin
[e + f*x]), x], x] /; FreeQ[{a, b, e, f, g}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] && LtQ[p, -1] && (IntegersQ[
2*m, 2*p] || IntegerQ[m])

Rule 2861

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.)
+ (f_.)*(x_)]), x_Symbol] :> -Simp[((g*Cos[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^m*(d + c*Sin[e + f*x]))/(f*
g*(p + 1)), x] + Dist[1/(g^2*(p + 1)), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^(m - 1)*Simp[a*c*(p +
2) + b*d*m + b*c*(m + p + 2)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && NeQ[a^2 - b^2, 0]
&& GtQ[m, 0] && LtQ[p, -1] && IntegerQ[2*m] &&  !(EqQ[m, 1] && NeQ[c^2 - d^2, 0] && SimplerQ[c + d*x, a + b*x
])

Rule 2734

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((2*a*c
+ b*d)*x)/2, x] + (-Simp[((b*c + a*d)*Cos[e + f*x])/f, x] - Simp[(b*d*Cos[e + f*x]*Sin[e + f*x])/(2*f), x]) /;
FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps

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

Mathematica [A]  time = 0.176357, size = 79, normalized size = 0.79 $\frac{1}{3} \left (2 \left (3 a^2 b^2+a^4-2 b^4\right ) \tanh (x)-4 a b \left (a^2-b^2\right ) \text{sech}^3(x)+\left (-6 a^2 b^2+a^4+b^4\right ) \tanh (x) \text{sech}^2(x)-12 a b^3 \text{sech}(x)+3 b^4 x\right )$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(3*b^4*x - 12*a*b^3*Sech[x] - 4*a*b*(a^2 - b^2)*Sech[x]^3 + 2*(a^4 + 3*a^2*b^2 - 2*b^4)*Tanh[x] + (a^4 - 6*a^2
*b^2 + b^4)*Sech[x]^2*Tanh[x])/3

________________________________________________________________________________________

Maple [A]  time = 0.032, size = 123, normalized size = 1.2 \begin{align*}{a}^{4} \left ({\frac{2}{3}}+{\frac{ \left ({\rm sech} \left (x\right ) \right ) ^{2}}{3}} \right ) \tanh \left ( x \right ) +4\,{a}^{3}b \left ( 1/3\,{\frac{ \left ( \sinh \left ( x \right ) \right ) ^{2}}{ \left ( \cosh \left ( x \right ) \right ) ^{3}}}+1/3\,{\frac{ \left ( \sinh \left ( x \right ) \right ) ^{2}}{\cosh \left ( x \right ) }}-1/3\,\cosh \left ( x \right ) \right ) +6\,{a}^{2}{b}^{2} \left ( -1/2\,{\frac{\sinh \left ( x \right ) }{ \left ( \cosh \left ( x \right ) \right ) ^{3}}}+1/2\, \left ( 2/3+1/3\, \left ({\rm sech} \left (x\right ) \right ) ^{2} \right ) \tanh \left ( x \right ) \right ) +4\,a{b}^{3} \left ( -1/3\,{\frac{ \left ( \sinh \left ( x \right ) \right ) ^{2}}{ \left ( \cosh \left ( x \right ) \right ) ^{3}}}+2/3\,{\frac{ \left ( \sinh \left ( x \right ) \right ) ^{2}}{\cosh \left ( x \right ) }}-2/3\,\cosh \left ( x \right ) \right ) +{b}^{4} \left ( x-\tanh \left ( x \right ) -{\frac{ \left ( \tanh \left ( x \right ) \right ) ^{3}}{3}} \right ) \end{align*}

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

[In]

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

[Out]

a^4*(2/3+1/3*sech(x)^2)*tanh(x)+4*a^3*b*(1/3*sinh(x)^2/cosh(x)^3+1/3*sinh(x)^2/cosh(x)-1/3*cosh(x))+6*a^2*b^2*
(-1/2*sinh(x)/cosh(x)^3+1/2*(2/3+1/3*sech(x)^2)*tanh(x))+4*a*b^3*(-1/3*sinh(x)^2/cosh(x)^3+2/3*sinh(x)^2/cosh(
x)-2/3*cosh(x))+b^4*(x-tanh(x)-1/3*tanh(x)^3)

________________________________________________________________________________________

Maxima [B]  time = 1.05966, size = 284, normalized size = 2.84 \begin{align*} 2 \, a^{2} b^{2} \tanh \left (x\right )^{3} + \frac{1}{3} \, b^{4}{\left (3 \, x - \frac{4 \,{\left (3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + 2\right )}}{3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1}\right )} - \frac{8}{3} \, a b^{3}{\left (\frac{3 \, e^{\left (-x\right )}}{3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1} + \frac{2 \, e^{\left (-3 \, x\right )}}{3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1} + \frac{3 \, e^{\left (-5 \, x\right )}}{3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1}\right )} + \frac{4}{3} \, a^{4}{\left (\frac{3 \, e^{\left (-2 \, x\right )}}{3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1} + \frac{1}{3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1}\right )} - \frac{32 \, a^{3} b}{3 \,{\left (e^{\left (-x\right )} + e^{x}\right )}^{3}} \end{align*}

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

[In]

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

[Out]

2*a^2*b^2*tanh(x)^3 + 1/3*b^4*(3*x - 4*(3*e^(-2*x) + 3*e^(-4*x) + 2)/(3*e^(-2*x) + 3*e^(-4*x) + e^(-6*x) + 1))
- 8/3*a*b^3*(3*e^(-x)/(3*e^(-2*x) + 3*e^(-4*x) + e^(-6*x) + 1) + 2*e^(-3*x)/(3*e^(-2*x) + 3*e^(-4*x) + e^(-6*
x) + 1) + 3*e^(-5*x)/(3*e^(-2*x) + 3*e^(-4*x) + e^(-6*x) + 1)) + 4/3*a^4*(3*e^(-2*x)/(3*e^(-2*x) + 3*e^(-4*x)
+ e^(-6*x) + 1) + 1/(3*e^(-2*x) + 3*e^(-4*x) + e^(-6*x) + 1)) - 32/3*a^3*b/(e^(-x) + e^x)^3

________________________________________________________________________________________

Fricas [B]  time = 2.30987, size = 505, normalized size = 5.05 \begin{align*} -\frac{24 \, a b^{3} \cosh \left (x\right )^{2} + 16 \, a^{3} b + 8 \, a b^{3} -{\left (3 \, b^{4} x - 2 \, a^{4} - 6 \, a^{2} b^{2} + 4 \, b^{4}\right )} \cosh \left (x\right )^{3} - 2 \,{\left (a^{4} + 3 \, a^{2} b^{2} - 2 \, b^{4}\right )} \sinh \left (x\right )^{3} + 3 \,{\left (8 \, a b^{3} -{\left (3 \, b^{4} x - 2 \, a^{4} - 6 \, a^{2} b^{2} + 4 \, b^{4}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )^{2} - 3 \,{\left (3 \, b^{4} x - 2 \, a^{4} - 6 \, a^{2} b^{2} + 4 \, b^{4}\right )} \cosh \left (x\right ) - 6 \,{\left (a^{4} - 3 \, a^{2} b^{2} +{\left (a^{4} + 3 \, a^{2} b^{2} - 2 \, b^{4}\right )} \cosh \left (x\right )^{2}\right )} \sinh \left (x\right )}{3 \,{\left (\cosh \left (x\right )^{3} + 3 \, \cosh \left (x\right ) \sinh \left (x\right )^{2} + 3 \, \cosh \left (x\right )\right )}} \end{align*}

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

[In]

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

[Out]

-1/3*(24*a*b^3*cosh(x)^2 + 16*a^3*b + 8*a*b^3 - (3*b^4*x - 2*a^4 - 6*a^2*b^2 + 4*b^4)*cosh(x)^3 - 2*(a^4 + 3*a
^2*b^2 - 2*b^4)*sinh(x)^3 + 3*(8*a*b^3 - (3*b^4*x - 2*a^4 - 6*a^2*b^2 + 4*b^4)*cosh(x))*sinh(x)^2 - 3*(3*b^4*x
- 2*a^4 - 6*a^2*b^2 + 4*b^4)*cosh(x) - 6*(a^4 - 3*a^2*b^2 + (a^4 + 3*a^2*b^2 - 2*b^4)*cosh(x)^2)*sinh(x))/(co
sh(x)^3 + 3*cosh(x)*sinh(x)^2 + 3*cosh(x))

________________________________________________________________________________________

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 )^{4}\, dx \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.13681, size = 149, normalized size = 1.49 \begin{align*} b^{4} x - \frac{4 \,{\left (6 \, a b^{3} e^{\left (5 \, x\right )} + 9 \, a^{2} b^{2} e^{\left (4 \, x\right )} - 3 \, b^{4} e^{\left (4 \, x\right )} + 8 \, a^{3} b e^{\left (3 \, x\right )} + 4 \, a b^{3} e^{\left (3 \, x\right )} + 3 \, a^{4} e^{\left (2 \, x\right )} - 3 \, b^{4} e^{\left (2 \, x\right )} + 6 \, a b^{3} e^{x} + a^{4} + 3 \, a^{2} b^{2} - 2 \, b^{4}\right )}}{3 \,{\left (e^{\left (2 \, x\right )} + 1\right )}^{3}} \end{align*}

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

[In]

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

[Out]

b^4*x - 4/3*(6*a*b^3*e^(5*x) + 9*a^2*b^2*e^(4*x) - 3*b^4*e^(4*x) + 8*a^3*b*e^(3*x) + 4*a*b^3*e^(3*x) + 3*a^4*e
^(2*x) - 3*b^4*e^(2*x) + 6*a*b^3*e^x + a^4 + 3*a^2*b^2 - 2*b^4)/(e^(2*x) + 1)^3