3.264 \(\int (a \sec (x)+b \tan (x))^4 \, dx\)

Optimal. Leaf size=100 \[ \frac{4}{3} a b \left (a^2-2 b^2\right ) \cos (x)+\frac{1}{3} b^2 \left (2 a^2-3 b^2\right ) \sin (x) \cos (x)-\frac{1}{3} \sec (x) (a+b \sin (x))^2 \left (a b-\left (2 a^2-3 b^2\right ) \sin (x)\right )+\frac{1}{3} \sec ^3(x) (a \sin (x)+b) (a+b \sin (x))^3+b^4 x \]

[Out]

b^4*x + (4*a*b*(a^2 - 2*b^2)*Cos[x])/3 + (b^2*(2*a^2 - 3*b^2)*Cos[x]*Sin[x])/3 + (Sec[x]^3*(b + a*Sin[x])*(a +
 b*Sin[x])^3)/3 - (Sec[x]*(a + b*Sin[x])^2*(a*b - (2*a^2 - 3*b^2)*Sin[x]))/3

________________________________________________________________________________________

Rubi [A]  time = 0.196253, 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 ) \cos (x)+\frac{1}{3} b^2 \left (2 a^2-3 b^2\right ) \sin (x) \cos (x)-\frac{1}{3} \sec (x) (a+b \sin (x))^2 \left (a b-\left (2 a^2-3 b^2\right ) \sin (x)\right )+\frac{1}{3} \sec ^3(x) (a \sin (x)+b) (a+b \sin (x))^3+b^4 x \]

Antiderivative was successfully verified.

[In]

Int[(a*Sec[x] + b*Tan[x])^4,x]

[Out]

b^4*x + (4*a*b*(a^2 - 2*b^2)*Cos[x])/3 + (b^2*(2*a^2 - 3*b^2)*Cos[x]*Sin[x])/3 + (Sec[x]^3*(b + a*Sin[x])*(a +
 b*Sin[x])^3)/3 - (Sec[x]*(a + b*Sin[x])^2*(a*b - (2*a^2 - 3*b^2)*Sin[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 \sec (x)+b \tan (x))^4 \, dx &=\int \sec ^4(x) (a+b \sin (x))^4 \, dx\\ &=\frac{1}{3} \sec ^3(x) (b+a \sin (x)) (a+b \sin (x))^3-\frac{1}{3} \int \sec ^2(x) (a+b \sin (x))^2 \left (-2 a^2+3 b^2+a b \sin (x)\right ) \, dx\\ &=\frac{1}{3} \sec ^3(x) (b+a \sin (x)) (a+b \sin (x))^3-\frac{1}{3} \sec (x) (a+b \sin (x))^2 \left (a b-\left (2 a^2-3 b^2\right ) \sin (x)\right )+\frac{1}{3} \int (a+b \sin (x)) \left (2 a b^2-2 b \left (2 a^2-3 b^2\right ) \sin (x)\right ) \, dx\\ &=b^4 x+\frac{4}{3} a b \left (a^2-2 b^2\right ) \cos (x)+\frac{1}{3} b^2 \left (2 a^2-3 b^2\right ) \cos (x) \sin (x)+\frac{1}{3} \sec ^3(x) (b+a \sin (x)) (a+b \sin (x))^3-\frac{1}{3} \sec (x) (a+b \sin (x))^2 \left (a b-\left (2 a^2-3 b^2\right ) \sin (x)\right )\\ \end{align*}

Mathematica [A]  time = 0.192781, size = 96, normalized size = 0.96 \[ \frac{1}{12} \sec ^3(x) \left (18 a^2 b^2 \sin (x)-6 a^2 b^2 \sin (3 x)+16 a^3 b+6 a^4 \sin (x)+2 a^4 \sin (3 x)-24 a b^3 \cos (2 x)-8 a b^3-4 b^4 \sin (3 x)+9 b^4 x \cos (x)+3 b^4 x \cos (3 x)\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(a*Sec[x] + b*Tan[x])^4,x]

[Out]

(Sec[x]^3*(16*a^3*b - 8*a*b^3 + 9*b^4*x*Cos[x] - 24*a*b^3*Cos[2*x] + 3*b^4*x*Cos[3*x] + 6*a^4*Sin[x] + 18*a^2*
b^2*Sin[x] + 2*a^4*Sin[3*x] - 6*a^2*b^2*Sin[3*x] - 4*b^4*Sin[3*x]))/12

________________________________________________________________________________________

Maple [A]  time = 0.06, size = 96, normalized size = 1. \begin{align*} -{a}^{4} \left ( -{\frac{2}{3}}-{\frac{ \left ( \sec \left ( x \right ) \right ) ^{2}}{3}} \right ) \tan \left ( x \right ) +{\frac{4\,{a}^{3}b}{3\, \left ( \cos \left ( x \right ) \right ) ^{3}}}+2\,{\frac{{a}^{2}{b}^{2} \left ( \sin \left ( x \right ) \right ) ^{3}}{ \left ( \cos \left ( x \right ) \right ) ^{3}}}+4\,a{b}^{3} \left ( 1/3\,{\frac{ \left ( \sin \left ( x \right ) \right ) ^{4}}{ \left ( \cos \left ( x \right ) \right ) ^{3}}}-1/3\,{\frac{ \left ( \sin \left ( x \right ) \right ) ^{4}}{\cos \left ( x \right ) }}-1/3\, \left ( 2+ \left ( \sin \left ( x \right ) \right ) ^{2} \right ) \cos \left ( x \right ) \right ) +{b}^{4} \left ({\frac{ \left ( \tan \left ( x \right ) \right ) ^{3}}{3}}-\tan \left ( x \right ) +x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*sec(x)+b*tan(x))^4,x)

[Out]

-a^4*(-2/3-1/3*sec(x)^2)*tan(x)+4/3*a^3*b/cos(x)^3+2*a^2*b^2*sin(x)^3/cos(x)^3+4*a*b^3*(1/3*sin(x)^4/cos(x)^3-
1/3*sin(x)^4/cos(x)-1/3*(2+sin(x)^2)*cos(x))+b^4*(1/3*tan(x)^3-tan(x)+x)

________________________________________________________________________________________

Maxima [A]  time = 1.60153, size = 97, normalized size = 0.97 \begin{align*} 2 \, a^{2} b^{2} \tan \left (x\right )^{3} + \frac{1}{3} \,{\left (\tan \left (x\right )^{3} + 3 \, \tan \left (x\right )\right )} a^{4} + \frac{1}{3} \,{\left (\tan \left (x\right )^{3} + 3 \, x - 3 \, \tan \left (x\right )\right )} b^{4} - \frac{4 \,{\left (3 \, \cos \left (x\right )^{2} - 1\right )} a b^{3}}{3 \, \cos \left (x\right )^{3}} + \frac{4 \, a^{3} b}{3 \, \cos \left (x\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))^4,x, algorithm="maxima")

[Out]

2*a^2*b^2*tan(x)^3 + 1/3*(tan(x)^3 + 3*tan(x))*a^4 + 1/3*(tan(x)^3 + 3*x - 3*tan(x))*b^4 - 4/3*(3*cos(x)^2 - 1
)*a*b^3/cos(x)^3 + 4/3*a^3*b/cos(x)^3

________________________________________________________________________________________

Fricas [A]  time = 2.18665, size = 196, normalized size = 1.96 \begin{align*} \frac{3 \, b^{4} x \cos \left (x\right )^{3} - 12 \, a b^{3} \cos \left (x\right )^{2} + 4 \, a^{3} b + 4 \, a b^{3} +{\left (a^{4} + 6 \, a^{2} b^{2} + b^{4} + 2 \,{\left (a^{4} - 3 \, a^{2} b^{2} - 2 \, b^{4}\right )} \cos \left (x\right )^{2}\right )} \sin \left (x\right )}{3 \, \cos \left (x\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))^4,x, algorithm="fricas")

[Out]

1/3*(3*b^4*x*cos(x)^3 - 12*a*b^3*cos(x)^2 + 4*a^3*b + 4*a*b^3 + (a^4 + 6*a^2*b^2 + b^4 + 2*(a^4 - 3*a^2*b^2 -
2*b^4)*cos(x)^2)*sin(x))/cos(x)^3

________________________________________________________________________________________

Sympy [A]  time = 4.69919, size = 97, normalized size = 0.97 \begin{align*} \frac{a^{4} \tan ^{3}{\left (x \right )}}{3} + a^{4} \tan{\left (x \right )} + \frac{4 a^{3} b \sec ^{3}{\left (x \right )}}{3} + 2 a^{2} b^{2} \tan ^{3}{\left (x \right )} + \frac{4 a b^{3} \sec ^{3}{\left (x \right )}}{3} - 4 a b^{3} \sec{\left (x \right )} + b^{4} x + \frac{b^{4} \sin ^{3}{\left (x \right )}}{3 \cos ^{3}{\left (x \right )}} - \frac{b^{4} \sin{\left (x \right )}}{\cos{\left (x \right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))**4,x)

[Out]

a**4*tan(x)**3/3 + a**4*tan(x) + 4*a**3*b*sec(x)**3/3 + 2*a**2*b**2*tan(x)**3 + 4*a*b**3*sec(x)**3/3 - 4*a*b**
3*sec(x) + b**4*x + b**4*sin(x)**3/(3*cos(x)**3) - b**4*sin(x)/cos(x)

________________________________________________________________________________________

Giac [A]  time = 1.12689, size = 177, normalized size = 1.77 \begin{align*} b^{4} x - \frac{2 \,{\left (3 \, a^{4} \tan \left (\frac{1}{2} \, x\right )^{5} - 3 \, b^{4} \tan \left (\frac{1}{2} \, x\right )^{5} + 12 \, a^{3} b \tan \left (\frac{1}{2} \, x\right )^{4} - 2 \, a^{4} \tan \left (\frac{1}{2} \, x\right )^{3} + 24 \, a^{2} b^{2} \tan \left (\frac{1}{2} \, x\right )^{3} + 10 \, b^{4} \tan \left (\frac{1}{2} \, x\right )^{3} + 24 \, a b^{3} \tan \left (\frac{1}{2} \, x\right )^{2} + 3 \, a^{4} \tan \left (\frac{1}{2} \, x\right ) - 3 \, b^{4} \tan \left (\frac{1}{2} \, x\right ) + 4 \, a^{3} b - 8 \, a b^{3}\right )}}{3 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{2} - 1\right )}^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))^4,x, algorithm="giac")

[Out]

b^4*x - 2/3*(3*a^4*tan(1/2*x)^5 - 3*b^4*tan(1/2*x)^5 + 12*a^3*b*tan(1/2*x)^4 - 2*a^4*tan(1/2*x)^3 + 24*a^2*b^2
*tan(1/2*x)^3 + 10*b^4*tan(1/2*x)^3 + 24*a*b^3*tan(1/2*x)^2 + 3*a^4*tan(1/2*x) - 3*b^4*tan(1/2*x) + 4*a^3*b -
8*a*b^3)/(tan(1/2*x)^2 - 1)^3