\(\int x \sin (x) \, dx\) [15]

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

[Out]

-x*cos(x)+sin(x)

Rubi [A] (verified)

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

[In]

Int[x*Sin[x],x]

[Out]

-(x*Cos[x]) + Sin[x]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[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 \cos (x)+\int \cos (x) \, dx \\ & = -x \cos (x)+\sin (x) \\ \end{align*}

Mathematica [A] (verified)

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

[In]

Integrate[x*Sin[x],x]

[Out]

-(x*Cos[x]) + Sin[x]

Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.12

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

[In]

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

[Out]

-x*cos(x)+sin(x)

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

-x*cos(x) + sin(x)

Sympy [A] (verification not implemented)

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

[In]

integrate(x*sin(x),x)

[Out]

-x*cos(x) + sin(x)

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

-x*cos(x) + sin(x)

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

-x*cos(x) + sin(x)

Mupad [B] (verification not implemented)

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

[In]

int(x*sin(x),x)

[Out]

sin(x) - x*cos(x)