3.323 \(\int (-\cos (x)+\sec (x))^3 \, dx\)

Optimal. Leaf size=34 \[ \frac {5 \sin ^3(x)}{6}+\frac {5 \sin (x)}{2}+\frac {1}{2} \sin ^3(x) \tan ^2(x)-\frac {5}{2} \tanh ^{-1}(\sin (x)) \]

[Out]

-5/2*arctanh(sin(x))+5/2*sin(x)+5/6*sin(x)^3+1/2*sin(x)^3*tan(x)^2

________________________________________________________________________________________

Rubi [A]  time = 0.04, antiderivative size = 34, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.556, Rules used = {4397, 2592, 288, 302, 206} \[ \frac {5 \sin ^3(x)}{6}+\frac {5 \sin (x)}{2}+\frac {1}{2} \sin ^3(x) \tan ^2(x)-\frac {5}{2} \tanh ^{-1}(\sin (x)) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(-5*ArcTanh[Sin[x]])/2 + (5*Sin[x])/2 + (5*Sin[x]^3)/6 + (Sin[x]^3*Tan[x]^2)/2

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[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]

Rule 2592

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, (a*Sin[e + f*x])/ff
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.01, size = 38, normalized size = 1.12 \[ -\frac {1}{3} \sin ^3(x) \tan ^2(x)-\frac {5}{3} \sin (x) \tan ^2(x)-\frac {5}{2} \tanh ^{-1}(\sin (x))+\frac {5}{2} \tan (x) \sec (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(-5*ArcTanh[Sin[x]])/2 + (5*Sec[x]*Tan[x])/2 - (5*Sin[x]*Tan[x]^2)/3 - (Sin[x]^3*Tan[x]^2)/3

________________________________________________________________________________________

fricas [A]  time = 0.94, size = 49, normalized size = 1.44 \[ -\frac {15 \, \cos \relax (x)^{2} \log \left (\sin \relax (x) + 1\right ) - 15 \, \cos \relax (x)^{2} \log \left (-\sin \relax (x) + 1\right ) + 2 \, {\left (2 \, \cos \relax (x)^{4} - 14 \, \cos \relax (x)^{2} - 3\right )} \sin \relax (x)}{12 \, \cos \relax (x)^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/12*(15*cos(x)^2*log(sin(x) + 1) - 15*cos(x)^2*log(-sin(x) + 1) + 2*(2*cos(x)^4 - 14*cos(x)^2 - 3)*sin(x))/c
os(x)^2

________________________________________________________________________________________

giac [A]  time = 0.15, size = 39, normalized size = 1.15 \[ \frac {1}{3} \, \sin \relax (x)^{3} - \frac {\sin \relax (x)}{2 \, {\left (\sin \relax (x)^{2} - 1\right )}} - \frac {5}{4} \, \log \left (\sin \relax (x) + 1\right ) + \frac {5}{4} \, \log \left (-\sin \relax (x) + 1\right ) + 2 \, \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/3*sin(x)^3 - 1/2*sin(x)/(sin(x)^2 - 1) - 5/4*log(sin(x) + 1) + 5/4*log(-sin(x) + 1) + 2*sin(x)

________________________________________________________________________________________

maple [A]  time = 0.06, size = 30, normalized size = 0.88 \[ \frac {\sec \relax (x ) \tan \relax (x )}{2}-\frac {5 \ln \left (\sec \relax (x )+\tan \relax (x )\right )}{2}+3 \sin \relax (x )-\frac {\left (2+\cos ^{2}\relax (x )\right ) \sin \relax (x )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*sec(x)*tan(x)-5/2*ln(sec(x)+tan(x))+3*sin(x)-1/3*(2+cos(x)^2)*sin(x)

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 37, normalized size = 1.09 \[ \frac {1}{3} \, \sin \relax (x)^{3} - \frac {\sin \relax (x)}{2 \, {\left (\sin \relax (x)^{2} - 1\right )}} - \frac {5}{4} \, \log \left (\sin \relax (x) + 1\right ) + \frac {5}{4} \, \log \left (\sin \relax (x) - 1\right ) + 2 \, \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/3*sin(x)^3 - 1/2*sin(x)/(sin(x)^2 - 1) - 5/4*log(sin(x) + 1) + 5/4*log(sin(x) - 1) + 2*sin(x)

________________________________________________________________________________________

mupad [B]  time = 2.46, size = 68, normalized size = 2.00 \[ \frac {5\,{\mathrm {tan}\left (\frac {x}{2}\right )}^9+\frac {20\,{\mathrm {tan}\left (\frac {x}{2}\right )}^7}{3}-\frac {22\,{\mathrm {tan}\left (\frac {x}{2}\right )}^5}{3}+\frac {20\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3}{3}+5\,\mathrm {tan}\left (\frac {x}{2}\right )}{{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2-1\right )}^2\,{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )}^3}-5\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {x}{2}\right )\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(5*tan(x/2) + (20*tan(x/2)^3)/3 - (22*tan(x/2)^5)/3 + (20*tan(x/2)^7)/3 + 5*tan(x/2)^9)/((tan(x/2)^2 - 1)^2*(t
an(x/2)^2 + 1)^3) - 5*atanh(tan(x/2))

________________________________________________________________________________________

sympy [A]  time = 3.74, size = 42, normalized size = 1.24 \[ \frac {5 \log {\left (\sin {\relax (x )} - 1 \right )}}{4} - \frac {5 \log {\left (\sin {\relax (x )} + 1 \right )}}{4} + \frac {\sin ^{3}{\relax (x )}}{3} + 2 \sin {\relax (x )} - \frac {\sin {\relax (x )}}{2 \sin ^{2}{\relax (x )} - 2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

5*log(sin(x) - 1)/4 - 5*log(sin(x) + 1)/4 + sin(x)**3/3 + 2*sin(x) - sin(x)/(2*sin(x)**2 - 2)

________________________________________________________________________________________