3.58 \(\int x (\cos (x)+\sin (x)) \, dx\)

Optimal. Leaf size=14 \[ x \sin (x)+\sin (x)-x \cos (x)+\cos (x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.571, Rules used = {14, 3296, 2638, 2637} \[ x \sin (x)+\sin (x)-x \cos (x)+\cos (x) \]

Antiderivative was successfully verified.

[In]

Int[x*(Cos[x] + Sin[x]),x]

[Out]

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

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2637

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

Rule 2638

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

Rule 3296

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*} \int x (\cos (x)+\sin (x)) \, dx &=\int (x \cos (x)+x \sin (x)) \, dx\\ &=\int x \cos (x) \, dx+\int x \sin (x) \, dx\\ &=-x \cos (x)+x \sin (x)+\int \cos (x) \, dx-\int \sin (x) \, dx\\ &=\cos (x)-x \cos (x)+\sin (x)+x \sin (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.00, size = 14, normalized size = 1.00 \[ x \sin (x)+\sin (x)-x \cos (x)+\cos (x) \]

Antiderivative was successfully verified.

[In]

Integrate[x*(Cos[x] + Sin[x]),x]

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.41, size = 14, normalized size = 1.00 \[ -{\left (x - 1\right )} \cos \relax (x) + {\left (x + 1\right )} \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 1.11, size = 14, normalized size = 1.00 \[ -x \cos \relax (x) + x \sin \relax (x) + \cos \relax (x) + \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.03, size = 15, normalized size = 1.07 \[ -x \cos \relax (x )+x \sin \relax (x )+\cos \relax (x )+\sin \relax (x ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*(cos(x)+sin(x)),x)

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.58, size = 14, normalized size = 1.00 \[ -x \cos \relax (x) + x \sin \relax (x) + \cos \relax (x) + \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.06, size = 14, normalized size = 1.00 \[ \cos \relax (x)+\sin \relax (x)-x\,\cos \relax (x)+x\,\sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*(cos(x) + sin(x)),x)

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.18, size = 15, normalized size = 1.07 \[ x \sin {\relax (x )} - x \cos {\relax (x )} + \sin {\relax (x )} + \cos {\relax (x )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(cos(x)+sin(x)),x)

[Out]

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

________________________________________________________________________________________