3.45 \(\int (x+\cos (x))^3 \, dx\)

Optimal. Leaf size=56 \[ \frac{x^4}{4}+\frac{3 x^2}{4}+3 x^2 \sin (x)-\frac{\sin ^3(x)}{3}-5 \sin (x)+\frac{3 \cos ^2(x)}{4}+6 x \cos (x)+\frac{3}{2} x \sin (x) \cos (x) \]

[Out]

(3*x^2)/4 + x^4/4 + 6*x*Cos[x] + (3*Cos[x]^2)/4 - 5*Sin[x] + 3*x^2*Sin[x] + (3*x*Cos[x]*Sin[x])/2 - Sin[x]^3/3

________________________________________________________________________________________

Rubi [A]  time = 0.0694327, antiderivative size = 56, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 6, integrand size = 6, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 1., Rules used = {6742, 3296, 2637, 3310, 30, 2633} \[ \frac{x^4}{4}+\frac{3 x^2}{4}+3 x^2 \sin (x)-\frac{\sin ^3(x)}{3}-5 \sin (x)+\frac{3 \cos ^2(x)}{4}+6 x \cos (x)+\frac{3}{2} x \sin (x) \cos (x) \]

Antiderivative was successfully verified.

[In]

Int[(x + Cos[x])^3,x]

[Out]

(3*x^2)/4 + x^4/4 + 6*x*Cos[x] + (3*Cos[x]^2)/4 - 5*Sin[x] + 3*x^2*Sin[x] + (3*x*Cos[x]*Sin[x])/2 - Sin[x]^3/3

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

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]

Rule 2637

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

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]

Rule 2633

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rubi steps

\begin{align*} \int (x+\cos (x))^3 \, dx &=\int \left (x^3+3 x^2 \cos (x)+3 x \cos ^2(x)+\cos ^3(x)\right ) \, dx\\ &=\frac{x^4}{4}+3 \int x^2 \cos (x) \, dx+3 \int x \cos ^2(x) \, dx+\int \cos ^3(x) \, dx\\ &=\frac{x^4}{4}+\frac{3 \cos ^2(x)}{4}+3 x^2 \sin (x)+\frac{3}{2} x \cos (x) \sin (x)+\frac{3 \int x \, dx}{2}-6 \int x \sin (x) \, dx-\operatorname{Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (x)\right )\\ &=\frac{3 x^2}{4}+\frac{x^4}{4}+6 x \cos (x)+\frac{3 \cos ^2(x)}{4}+\sin (x)+3 x^2 \sin (x)+\frac{3}{2} x \cos (x) \sin (x)-\frac{\sin ^3(x)}{3}-6 \int \cos (x) \, dx\\ &=\frac{3 x^2}{4}+\frac{x^4}{4}+6 x \cos (x)+\frac{3 \cos ^2(x)}{4}-5 \sin (x)+3 x^2 \sin (x)+\frac{3}{2} x \cos (x) \sin (x)-\frac{\sin ^3(x)}{3}\\ \end{align*}

Mathematica [A]  time = 0.103939, size = 51, normalized size = 0.91 \[ \frac{1}{12} \left (3 x^4+9 x^2+9 \left (4 x^2-7\right ) \sin (x)+9 x \sin (2 x)+\sin (3 x)\right )+6 x \cos (x)+\frac{3}{8} \cos (2 x) \]

Antiderivative was successfully verified.

[In]

Integrate[(x + Cos[x])^3,x]

[Out]

6*x*Cos[x] + (3*Cos[2*x])/8 + (9*x^2 + 3*x^4 + 9*(-7 + 4*x^2)*Sin[x] + 9*x*Sin[2*x] + Sin[3*x])/12

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x+cos(x))^3,x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.1555, size = 62, normalized size = 1.11 \begin{align*} \frac{1}{4} \, x^{4} - \frac{1}{3} \, \sin \left (x\right )^{3} + \frac{3}{4} \, x^{2} + 6 \, x \cos \left (x\right ) + \frac{3}{4} \, x \sin \left (2 \, x\right ) + 3 \,{\left (x^{2} - 2\right )} \sin \left (x\right ) + \frac{3}{8} \, \cos \left (2 \, x\right ) + \sin \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x+cos(x))^3,x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.32278, size = 135, normalized size = 2.41 \begin{align*} \frac{1}{4} \, x^{4} + \frac{3}{4} \, x^{2} + 6 \, x \cos \left (x\right ) + \frac{3}{4} \, \cos \left (x\right )^{2} + \frac{1}{6} \,{\left (18 \, x^{2} + 9 \, x \cos \left (x\right ) + 2 \, \cos \left (x\right )^{2} - 32\right )} \sin \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x+cos(x))^3,x, algorithm="fricas")

[Out]

1/4*x^4 + 3/4*x^2 + 6*x*cos(x) + 3/4*cos(x)^2 + 1/6*(18*x^2 + 9*x*cos(x) + 2*cos(x)^2 - 32)*sin(x)

________________________________________________________________________________________

Sympy [A]  time = 0.5201, size = 85, normalized size = 1.52 \begin{align*} \frac{x^{4}}{4} + \frac{3 x^{2} \sin ^{2}{\left (x \right )}}{4} + 3 x^{2} \sin{\left (x \right )} + \frac{3 x^{2} \cos ^{2}{\left (x \right )}}{4} + \frac{3 x \sin{\left (x \right )} \cos{\left (x \right )}}{2} + 6 x \cos{\left (x \right )} + \frac{2 \sin ^{3}{\left (x \right )}}{3} + \sin{\left (x \right )} \cos ^{2}{\left (x \right )} - 6 \sin{\left (x \right )} + \frac{3 \cos ^{2}{\left (x \right )}}{4} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.12398, size = 62, normalized size = 1.11 \begin{align*} \frac{1}{4} \, x^{4} + \frac{3}{4} \, x^{2} + 6 \, x \cos \left (x\right ) + \frac{3}{4} \, x \sin \left (2 \, x\right ) + \frac{3}{4} \,{\left (4 \, x^{2} - 7\right )} \sin \left (x\right ) + \frac{3}{8} \, \cos \left (2 \, x\right ) + \frac{1}{12} \, \sin \left (3 \, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x+cos(x))^3,x, algorithm="giac")

[Out]

1/4*x^4 + 3/4*x^2 + 6*x*cos(x) + 3/4*x*sin(2*x) + 3/4*(4*x^2 - 7)*sin(x) + 3/8*cos(2*x) + 1/12*sin(3*x)