3.3.84 \(\int (x+x \cos (x)+\sin (x)+\cos (x) \sin (x)) \, dx\) [284]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 20, normalized size of antiderivative = 2.00, number of steps used = 6, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {3377, 2718, 2644, 30} \begin {gather*} \frac {x^2}{2}+\frac {\sin ^2(x)}{2}+x \sin (x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 30

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

Rule 2644

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

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 {gather*} \begin {aligned} \text {Integral} &=\frac {x^2}{2}+\int x \cos (x) \, dx+\int \sin (x) \, dx+\int \cos (x) \sin (x) \, dx\\ &=\frac {x^2}{2}-\cos (x)+x \sin (x)-\int \sin (x) \, dx+\text {Subst}(\int x \, dx,x,\sin (x))\\ &=\frac {x^2}{2}+x \sin (x)+\frac {\sin ^2(x)}{2}\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 20, normalized size = 2.00 \begin {gather*} \frac {x^2}{2}-\frac {\cos ^2(x)}{2}+x \sin (x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

x^2/2 - Cos[x]^2/2 + x*Sin[x]

________________________________________________________________________________________

Maple [A]
time = 0.11, size = 17, normalized size = 1.70

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.33, size = 16, normalized size = 1.60 \begin {gather*} \frac {1}{2} \, x^{2} - \frac {1}{2} \, \cos \left (x\right )^{2} + x \sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.58, size = 16, normalized size = 1.60 \begin {gather*} \frac {1}{2} \, x^{2} - \frac {1}{2} \, \cos \left (x\right )^{2} + x \sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 15 vs. \(2 (7) = 14\).
time = 0.06, size = 15, normalized size = 1.50 \begin {gather*} \frac {x^{2}}{2} + x \sin {\left (x \right )} + \frac {\sin ^{2}{\left (x \right )}}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.56, size = 16, normalized size = 1.60 \begin {gather*} \frac {1}{2} \, x^{2} - \frac {1}{2} \, \cos \left (x\right )^{2} + x \sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.06, size = 8, normalized size = 0.80 \begin {gather*} \frac {{\left (x+\sin \left (x\right )\right )}^2}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(x + sin(x))^2/2

________________________________________________________________________________________

Chatgpt [F] Failed to verify
time = 1.00, size = 14, normalized size = 1.40 \begin {gather*} \frac {x^{2}}{2}-\cos \left (x \right )+x \sin \left (x \right ) \end {gather*}

Warning: Unable to verify antiderivative.

[In]

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

[Out]

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

________________________________________________________________________________________