\(\int \cos (x) (\sec ^3(x)+\tan (x)) \, dx\) [816]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 7 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=-\cos (x)+\tan (x) \]

[Out]

-cos(x)+tan(x)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4486, 3852, 8, 2718} \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=\tan (x)-\cos (x) \]

[In]

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

[Out]

-Cos[x] + Tan[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 4486

Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /;  !InertTrigFreeQ[u]

Rubi steps \begin{align*} \text {integral}& = \int \left (\sec ^2(x)+\sin (x)\right ) \, dx \\ & = \int \sec ^2(x) \, dx+\int \sin (x) \, dx \\ & = -\cos (x)-\text {Subst}(\int 1 \, dx,x,-\tan (x)) \\ & = -\cos (x)+\tan (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=-\cos (x)+\tan (x) \]

[In]

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

[Out]

-Cos[x] + Tan[x]

Maple [A] (verified)

Time = 5.48 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.14

method result size
default \(-\cos \left (x \right )+\tan \left (x \right )\) \(8\)
risch \(\frac {2 i}{{\mathrm e}^{2 i x}+1}-\cos \left (x \right )\) \(18\)

[In]

int(cos(x)*(sec(x)^3+tan(x)),x,method=_RETURNVERBOSE)

[Out]

-cos(x)+tan(x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 15 vs. \(2 (7) = 14\).

Time = 0.24 (sec) , antiderivative size = 15, normalized size of antiderivative = 2.14 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=-\frac {\cos \left (x\right )^{2} - \sin \left (x\right )}{\cos \left (x\right )} \]

[In]

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

[Out]

-(cos(x)^2 - sin(x))/cos(x)

Sympy [A] (verification not implemented)

Time = 2.90 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.14 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=\frac {\sin {\left (x \right )}}{\cos {\left (x \right )}} - \cos {\left (x \right )} \]

[In]

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

[Out]

sin(x)/cos(x) - cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=-\cos \left (x\right ) + \tan \left (x\right ) \]

[In]

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

[Out]

-cos(x) + tan(x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 30 vs. \(2 (7) = 14\).

Time = 0.27 (sec) , antiderivative size = 30, normalized size of antiderivative = 4.29 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=-\frac {2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{3} + \tan \left (\frac {1}{2} \, x\right )^{2} + \tan \left (\frac {1}{2} \, x\right ) - 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} - 1} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 25.43 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.71 \[ \int \cos (x) \left (\sec ^3(x)+\tan (x)\right ) \, dx=\frac {\sin \left (x\right )}{\cos \left (x\right )}-\cos \left (x\right ) \]

[In]

int(cos(x)*(tan(x) + 1/cos(x)^3),x)

[Out]

sin(x)/cos(x) - cos(x)