### 3.310 $$\int (-3+4 x+x^2) \sin (2 x) \, dx$$

Optimal. Leaf size=40 $-\frac{1}{2} x^2 \cos (2 x)+\frac{1}{2} x \sin (2 x)+\sin (2 x)-2 x \cos (2 x)+\frac{7}{4} \cos (2 x)$

[Out]

(7*Cos[2*x])/4 - 2*x*Cos[2*x] - (x^2*Cos[2*x])/2 + Sin[2*x] + (x*Sin[2*x])/2

________________________________________________________________________________________

Rubi [A]  time = 0.0667267, antiderivative size = 40, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 4, integrand size = 13, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.308, Rules used = {6742, 2638, 3296, 2637} $-\frac{1}{2} x^2 \cos (2 x)+\frac{1}{2} x \sin (2 x)+\sin (2 x)-2 x \cos (2 x)+\frac{7}{4} \cos (2 x)$

Antiderivative was successfully veriﬁed.

[In]

Int[(-3 + 4*x + x^2)*Sin[2*x],x]

[Out]

(7*Cos[2*x])/4 - 2*x*Cos[2*x] - (x^2*Cos[2*x])/2 + Sin[2*x] + (x*Sin[2*x])/2

Rule 6742

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

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]

Rule 2637

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

Rubi steps

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

Mathematica [A]  time = 0.0374874, size = 29, normalized size = 0.72 $\frac{1}{4} \left (\left (-2 x^2-8 x+7\right ) \cos (2 x)+2 (x+2) \sin (2 x)\right )$

Antiderivative was successfully veriﬁed.

[In]

Integrate[(-3 + 4*x + x^2)*Sin[2*x],x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.007, size = 35, normalized size = 0.9 \begin{align*}{\frac{7\,\cos \left ( 2\,x \right ) }{4}}-2\,x\cos \left ( 2\,x \right ) -{\frac{{x}^{2}\cos \left ( 2\,x \right ) }{2}}+\sin \left ( 2\,x \right ) +{\frac{x\sin \left ( 2\,x \right ) }{2}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int((x^2+4*x-3)*sin(2*x),x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 0.95162, size = 51, normalized size = 1.27 \begin{align*} -\frac{1}{4} \,{\left (2 \, x^{2} - 1\right )} \cos \left (2 \, x\right ) - 2 \, x \cos \left (2 \, x\right ) + \frac{1}{2} \, x \sin \left (2 \, x\right ) + \frac{3}{2} \, \cos \left (2 \, x\right ) + \sin \left (2 \, x\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+4*x-3)*sin(2*x),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.26788, size = 76, normalized size = 1.9 \begin{align*} -\frac{1}{4} \,{\left (2 \, x^{2} + 8 \, x - 7\right )} \cos \left (2 \, x\right ) + \frac{1}{2} \,{\left (x + 2\right )} \sin \left (2 \, x\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+4*x-3)*sin(2*x),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.31514, size = 39, normalized size = 0.98 \begin{align*} - \frac{x^{2} \cos{\left (2 x \right )}}{2} + \frac{x \sin{\left (2 x \right )}}{2} - 2 x \cos{\left (2 x \right )} + \sin{\left (2 x \right )} + \frac{7 \cos{\left (2 x \right )}}{4} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**2+4*x-3)*sin(2*x),x)

[Out]

-x**2*cos(2*x)/2 + x*sin(2*x)/2 - 2*x*cos(2*x) + sin(2*x) + 7*cos(2*x)/4

________________________________________________________________________________________

Giac [A]  time = 1.04826, size = 35, normalized size = 0.88 \begin{align*} -\frac{1}{4} \,{\left (2 \, x^{2} + 8 \, x - 7\right )} \cos \left (2 \, x\right ) + \frac{1}{2} \,{\left (x + 2\right )} \sin \left (2 \, x\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+4*x-3)*sin(2*x),x, algorithm="giac")

[Out]

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