3.99 \(\int x \cos ^2(x) \, dx\)

Optimal. Leaf size=25 \[ \frac{x^2}{4}+\frac{\cos ^2(x)}{4}+\frac{1}{2} x \sin (x) \cos (x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.014378, antiderivative size = 25, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 6, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.333, Rules used = {3310, 30} \[ \frac{x^2}{4}+\frac{\cos ^2(x)}{4}+\frac{1}{2} x \sin (x) \cos (x) \]

Antiderivative was successfully verified.

[In]

Int[x*Cos[x]^2,x]

[Out]

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

Rule 3310

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

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rubi steps

\begin{align*} \int x \cos ^2(x) \, dx &=\frac{\cos ^2(x)}{4}+\frac{1}{2} x \cos (x) \sin (x)+\frac{\int x \, dx}{2}\\ &=\frac{x^2}{4}+\frac{\cos ^2(x)}{4}+\frac{1}{2} x \cos (x) \sin (x)\\ \end{align*}

Mathematica [A]  time = 0.0106562, size = 25, normalized size = 1. \[ \frac{x^2}{4}+\frac{1}{4} x \sin (2 x)+\frac{1}{8} \cos (2 x) \]

Antiderivative was successfully verified.

[In]

Integrate[x*Cos[x]^2,x]

[Out]

x^2/4 + Cos[2*x]/8 + (x*Sin[2*x])/4

________________________________________________________________________________________

Maple [A]  time = 0.005, size = 25, normalized size = 1. \begin{align*} x \left ({\frac{x}{2}}+{\frac{\cos \left ( x \right ) \sin \left ( x \right ) }{2}} \right ) -{\frac{{x}^{2}}{4}}-{\frac{ \left ( \sin \left ( x \right ) \right ) ^{2}}{4}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cos(x)^2,x)

[Out]

x*(1/2*x+1/2*cos(x)*sin(x))-1/4*x^2-1/4*sin(x)^2

________________________________________________________________________________________

Maxima [A]  time = 0.952112, size = 26, normalized size = 1.04 \begin{align*} \frac{1}{4} \, x^{2} + \frac{1}{4} \, x \sin \left (2 \, x\right ) + \frac{1}{8} \, \cos \left (2 \, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/4*x^2 + 1/4*x*sin(2*x) + 1/8*cos(2*x)

________________________________________________________________________________________

Fricas [A]  time = 1.66428, size = 62, normalized size = 2.48 \begin{align*} \frac{1}{2} \, x \cos \left (x\right ) \sin \left (x\right ) + \frac{1}{4} \, x^{2} + \frac{1}{4} \, \cos \left (x\right )^{2} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.336439, size = 36, normalized size = 1.44 \begin{align*} \frac{x^{2} \sin ^{2}{\left (x \right )}}{4} + \frac{x^{2} \cos ^{2}{\left (x \right )}}{4} + \frac{x \sin{\left (x \right )} \cos{\left (x \right )}}{2} - \frac{\sin ^{2}{\left (x \right )}}{4} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(x)**2,x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.07154, size = 26, normalized size = 1.04 \begin{align*} \frac{1}{4} \, x^{2} + \frac{1}{4} \, x \sin \left (2 \, x\right ) + \frac{1}{8} \, \cos \left (2 \, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/4*x^2 + 1/4*x*sin(2*x) + 1/8*cos(2*x)