\(\int x \cos (x) \, dx\) [97]

   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 = 7 \[ \int x \cos (x) \, dx=\cos (x)+x \sin (x) \]

[Out]

cos(x)+x*sin(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 7, 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 = {3377, 2718} \[ \int x \cos (x) \, dx=x \sin (x)+\cos (x) \]

[In]

Int[x*Cos[x],x]

[Out]

Cos[x] + x*Sin[x]

Rule 2718

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

Rule 3377

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

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

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int x \cos (x) \, dx=\cos (x)+x \sin (x) \]

[In]

Integrate[x*Cos[x],x]

[Out]

Cos[x] + x*Sin[x]

Maple [A] (verified)

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

method result size
default \(\cos \left (x \right )+x \sin \left (x \right )\) \(8\)
risch \(\cos \left (x \right )+x \sin \left (x \right )\) \(8\)
parts \(\cos \left (x \right )+x \sin \left (x \right )\) \(8\)
parallelrisch \(x \sin \left (x \right )+\cos \left (x \right )+1\) \(9\)
norman \(\frac {2 x \tan \left (\frac {x}{2}\right )+2}{1+\tan ^{2}\left (\frac {x}{2}\right )}\) \(21\)
meijerg \(2 \sqrt {\pi }\, \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\cos \left (x \right )}{2 \sqrt {\pi }}+\frac {x \sin \left (x \right )}{2 \sqrt {\pi }}\right )\) \(27\)

[In]

int(x*cos(x),x,method=_RETURNVERBOSE)

[Out]

cos(x)+x*sin(x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int x \cos (x) \, dx=x \sin \left (x\right ) + \cos \left (x\right ) \]

[In]

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

[Out]

x*sin(x) + cos(x)

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int x \cos (x) \, dx=x \sin {\left (x \right )} + \cos {\left (x \right )} \]

[In]

integrate(x*cos(x),x)

[Out]

x*sin(x) + cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int x \cos (x) \, dx=x \sin \left (x\right ) + \cos \left (x\right ) \]

[In]

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

[Out]

x*sin(x) + cos(x)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int x \cos (x) \, dx=x \sin \left (x\right ) + \cos \left (x\right ) \]

[In]

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

[Out]

x*sin(x) + cos(x)

Mupad [B] (verification not implemented)

Time = 0.02 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int x \cos (x) \, dx=\cos \left (x\right )+x\,\sin \left (x\right ) \]

[In]

int(x*cos(x),x)

[Out]

cos(x) + x*sin(x)