\(\int \cos ^2(x) (1-\tan ^2(x)) \, dx\) [804]

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

Optimal result

Integrand size = 13, antiderivative size = 5 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\cos (x) \sin (x) \]

[Out]

cos(x)*sin(x)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3756, 391} \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\sin (x) \cos (x) \]

[In]

Int[Cos[x]^2*(1 - Tan[x]^2),x]

[Out]

Cos[x]*Sin[x]

Rule 391

Int[((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*x*((a + b*x^n)^(p + 1)/a), x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && EqQ[a*d - b*c*(n*(p + 1) + 1), 0]

Rule 3756

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

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

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.60 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\frac {1}{2} \sin (2 x) \]

[In]

Integrate[Cos[x]^2*(1 - Tan[x]^2),x]

[Out]

Sin[2*x]/2

Maple [A] (verified)

Time = 3.15 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.20

method result size
default \(\cos \left (x \right ) \sin \left (x \right )\) \(6\)
risch \(\frac {\sin \left (2 x \right )}{2}\) \(7\)

[In]

int(cos(x)^2*(1-tan(x)^2),x,method=_RETURNVERBOSE)

[Out]

cos(x)*sin(x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\cos \left (x\right ) \sin \left (x\right ) \]

[In]

integrate(cos(x)^2*(1-tan(x)^2),x, algorithm="fricas")

[Out]

cos(x)*sin(x)

Sympy [B] (verification not implemented)

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

Time = 1.64 (sec) , antiderivative size = 14, normalized size of antiderivative = 2.80 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\frac {\sin {\left (x \right )} \cos {\left (x \right )}}{2} + \frac {\sin {\left (2 x \right )}}{4} \]

[In]

integrate(cos(x)**2*(1-tan(x)**2),x)

[Out]

sin(x)*cos(x)/2 + sin(2*x)/4

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 11 vs. \(2 (5) = 10\).

Time = 0.21 (sec) , antiderivative size = 11, normalized size of antiderivative = 2.20 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\frac {\tan \left (x\right )}{\tan \left (x\right )^{2} + 1} \]

[In]

integrate(cos(x)^2*(1-tan(x)^2),x, algorithm="maxima")

[Out]

tan(x)/(tan(x)^2 + 1)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.80 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\frac {1}{\frac {1}{\tan \left (x\right )} + \tan \left (x\right )} \]

[In]

integrate(cos(x)^2*(1-tan(x)^2),x, algorithm="giac")

[Out]

1/(1/tan(x) + tan(x))

Mupad [B] (verification not implemented)

Time = 25.92 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.20 \[ \int \cos ^2(x) \left (1-\tan ^2(x)\right ) \, dx=\frac {\sin \left (2\,x\right )}{2} \]

[In]

int(-cos(x)^2*(tan(x)^2 - 1),x)

[Out]

sin(2*x)/2