\(\int \cos ^2(x) \, dx\) [266]

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

Optimal result

Integrand size = 4, antiderivative size = 14 \[ \int \cos ^2(x) \, dx=\frac {x}{2}+\frac {1}{2} \cos (x) \sin (x) \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 14, 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.500, Rules used = {2715, 8} \[ \int \cos ^2(x) \, dx=\frac {x}{2}+\frac {1}{2} \sin (x) \cos (x) \]

[In]

Int[Cos[x]^2,x]

[Out]

x/2 + (Cos[x]*Sin[x])/2

Rule 8

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

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

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

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00 \[ \int \cos ^2(x) \, dx=\frac {x}{2}+\frac {1}{4} \sin (2 x) \]

[In]

Integrate[Cos[x]^2,x]

[Out]

x/2 + Sin[2*x]/4

Maple [A] (verified)

Time = 0.06 (sec) , antiderivative size = 11, normalized size of antiderivative = 0.79

method result size
default \(\frac {x}{2}+\frac {\cos \left (x \right ) \sin \left (x \right )}{2}\) \(11\)
risch \(\frac {x}{2}+\frac {\sin \left (2 x \right )}{4}\) \(11\)
parallelrisch \(\frac {x}{2}+\frac {\sin \left (2 x \right )}{4}\) \(11\)
norman \(\frac {x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+\frac {x}{2}-\left (\tan ^{3}\left (\frac {x}{2}\right )\right )+\frac {x \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{2}+\tan \left (\frac {x}{2}\right )}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )^{2}}\) \(45\)

[In]

int(1/sec(x)^2,x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.71 \[ \int \cos ^2(x) \, dx=\frac {1}{2} \, \cos \left (x\right ) \sin \left (x\right ) + \frac {1}{2} \, x \]

[In]

integrate(1/sec(x)^2,x, algorithm="fricas")

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.02 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.71 \[ \int \cos ^2(x) \, dx=\frac {x}{2} + \frac {\sin {\left (x \right )} \cos {\left (x \right )}}{2} \]

[In]

integrate(1/sec(x)**2,x)

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.71 \[ \int \cos ^2(x) \, dx=\frac {1}{2} \, x + \frac {1}{4} \, \sin \left (2 \, x\right ) \]

[In]

integrate(1/sec(x)^2,x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

integrate(1/sec(x)^2,x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.00 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.71 \[ \int \cos ^2(x) \, dx=\frac {x}{2}+\frac {\sin \left (2\,x\right )}{4} \]

[In]

int(cos(x)^2,x)

[Out]

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