3.322 \(\int (-\cos (x)+\sec (x))^4 \, dx\)

Optimal. Leaf size=44 \[ \frac {35 x}{8}+\frac {35 \tan ^3(x)}{24}-\frac {35 \tan (x)}{8}-\frac {1}{4} \sin ^4(x) \tan ^3(x)-\frac {7}{8} \sin ^2(x) \tan ^3(x) \]

[Out]

35/8*x-35/8*tan(x)+35/24*tan(x)^3-7/8*sin(x)^2*tan(x)^3-1/4*sin(x)^4*tan(x)^3

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {288, 302, 203} \[ \frac {35 x}{8}+\frac {35 \tan ^3(x)}{24}-\frac {35 \tan (x)}{8}-\frac {1}{4} \sin ^4(x) \tan ^3(x)-\frac {7}{8} \sin ^2(x) \tan ^3(x) \]

Antiderivative was successfully verified.

[In]

Int[(-Cos[x] + Sec[x])^4,x]

[Out]

(35*x)/8 - (35*Tan[x])/8 + (35*Tan[x]^3)/24 - (7*Sin[x]^2*Tan[x]^3)/8 - (Sin[x]^4*Tan[x]^3)/4

Rule 203

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

Rule 288

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(c^(n - 1)*(c*x)^(m - n + 1)*(a + b*x^
n)^(p + 1))/(b*n*(p + 1)), x] - Dist[(c^n*(m - n + 1))/(b*n*(p + 1)), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 302

Int[(x_)^(m_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Int[PolynomialDivide[x^m, a + b*x^n, x], x] /; FreeQ[{a,
b}, x] && IGtQ[m, 0] && IGtQ[n, 0] && GtQ[m, 2*n - 1]

Rubi steps

\begin {align*} \int (-\cos (x)+\sec (x))^4 \, dx &=\operatorname {Subst}\left (\int \frac {x^8}{\left (1+x^2\right )^3} \, dx,x,\tan (x)\right )\\ &=-\frac {1}{4} \sin ^4(x) \tan ^3(x)+\frac {7}{4} \operatorname {Subst}\left (\int \frac {x^6}{\left (1+x^2\right )^2} \, dx,x,\tan (x)\right )\\ &=-\frac {7}{8} \sin ^2(x) \tan ^3(x)-\frac {1}{4} \sin ^4(x) \tan ^3(x)+\frac {35}{8} \operatorname {Subst}\left (\int \frac {x^4}{1+x^2} \, dx,x,\tan (x)\right )\\ &=-\frac {7}{8} \sin ^2(x) \tan ^3(x)-\frac {1}{4} \sin ^4(x) \tan ^3(x)+\frac {35}{8} \operatorname {Subst}\left (\int \left (-1+x^2+\frac {1}{1+x^2}\right ) \, dx,x,\tan (x)\right )\\ &=-\frac {35 \tan (x)}{8}+\frac {35 \tan ^3(x)}{24}-\frac {7}{8} \sin ^2(x) \tan ^3(x)-\frac {1}{4} \sin ^4(x) \tan ^3(x)+\frac {35}{8} \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (x)\right )\\ &=\frac {35 x}{8}-\frac {35 \tan (x)}{8}+\frac {35 \tan ^3(x)}{24}-\frac {7}{8} \sin ^2(x) \tan ^3(x)-\frac {1}{4} \sin ^4(x) \tan ^3(x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 38, normalized size = 0.86 \[ \frac {35 x}{8}-\frac {3}{4} \sin (2 x)+\frac {1}{32} \sin (4 x)-\frac {10 \tan (x)}{3}+\frac {1}{3} \tan (x) \sec ^2(x) \]

Antiderivative was successfully verified.

[In]

Integrate[(-Cos[x] + Sec[x])^4,x]

[Out]

(35*x)/8 - (3*Sin[2*x])/4 + Sin[4*x]/32 - (10*Tan[x])/3 + (Sec[x]^2*Tan[x])/3

________________________________________________________________________________________

fricas [A]  time = 1.85, size = 37, normalized size = 0.84 \[ \frac {105 \, x \cos \relax (x)^{3} + {\left (6 \, \cos \relax (x)^{6} - 39 \, \cos \relax (x)^{4} - 80 \, \cos \relax (x)^{2} + 8\right )} \sin \relax (x)}{24 \, \cos \relax (x)^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sec(x))^4,x, algorithm="fricas")

[Out]

1/24*(105*x*cos(x)^3 + (6*cos(x)^6 - 39*cos(x)^4 - 80*cos(x)^2 + 8)*sin(x))/cos(x)^3

________________________________________________________________________________________

giac [A]  time = 0.14, size = 35, normalized size = 0.80 \[ \frac {1}{3} \, \tan \relax (x)^{3} + \frac {35}{8} \, x - \frac {13 \, \tan \relax (x)^{3} + 11 \, \tan \relax (x)}{8 \, {\left (\tan \relax (x)^{2} + 1\right )}^{2}} - 3 \, \tan \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sec(x))^4,x, algorithm="giac")

[Out]

1/3*tan(x)^3 + 35/8*x - 1/8*(13*tan(x)^3 + 11*tan(x))/(tan(x)^2 + 1)^2 - 3*tan(x)

________________________________________________________________________________________

maple [A]  time = 0.06, size = 40, normalized size = 0.91 \[ -\left (-\frac {2}{3}-\frac {\left (\sec ^{2}\relax (x )\right )}{3}\right ) \tan \relax (x )-4 \tan \relax (x )+\frac {35 x}{8}-2 \cos \relax (x ) \sin \relax (x )+\frac {\left (\cos ^{3}\relax (x )+\frac {3 \cos \relax (x )}{2}\right ) \sin \relax (x )}{4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((-cos(x)+sec(x))^4,x)

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 26, normalized size = 0.59 \[ \frac {1}{3} \, \tan \relax (x)^{3} + \frac {35}{8} \, x + \frac {1}{32} \, \sin \left (4 \, x\right ) - \frac {3}{4} \, \sin \left (2 \, x\right ) - 3 \, \tan \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sec(x))^4,x, algorithm="maxima")

[Out]

1/3*tan(x)^3 + 35/8*x + 1/32*sin(4*x) - 3/4*sin(2*x) - 3*tan(x)

________________________________________________________________________________________

mupad [B]  time = 2.57, size = 80, normalized size = 1.82 \[ \frac {35\,x}{8}+\frac {\frac {35\,{\mathrm {tan}\left (\frac {x}{2}\right )}^{13}}{4}+\frac {35\,{\mathrm {tan}\left (\frac {x}{2}\right )}^{11}}{6}-\frac {329\,{\mathrm {tan}\left (\frac {x}{2}\right )}^9}{12}-17\,{\mathrm {tan}\left (\frac {x}{2}\right )}^7-\frac {329\,{\mathrm {tan}\left (\frac {x}{2}\right )}^5}{12}+\frac {35\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3}{6}+\frac {35\,\mathrm {tan}\left (\frac {x}{2}\right )}{4}}{{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2-1\right )}^3\,{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )}^4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(x) - 1/cos(x))^4,x)

[Out]

(35*x)/8 + ((35*tan(x/2))/4 + (35*tan(x/2)^3)/6 - (329*tan(x/2)^5)/12 - 17*tan(x/2)^7 - (329*tan(x/2)^9)/12 +
(35*tan(x/2)^11)/6 + (35*tan(x/2)^13)/4)/((tan(x/2)^2 - 1)^3*(tan(x/2)^2 + 1)^4)

________________________________________________________________________________________

sympy [A]  time = 8.97, size = 44, normalized size = 1.00 \[ \frac {35 x}{8} - 2 \sin {\relax (x )} \cos {\relax (x )} - \frac {4 \sin {\relax (x )}}{\cos {\relax (x )}} + \frac {\sin {\left (2 x \right )}}{4} + \frac {\sin {\left (4 x \right )}}{32} + \frac {\tan ^{3}{\relax (x )}}{3} + \tan {\relax (x )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sec(x))**4,x)

[Out]

35*x/8 - 2*sin(x)*cos(x) - 4*sin(x)/cos(x) + sin(2*x)/4 + sin(4*x)/32 + tan(x)**3/3 + tan(x)

________________________________________________________________________________________