3.920 \(\int (a+b x+c x^2) \sin (x) \, dx\)

Optimal. Leaf size=35 \[ -a \cos (x)+b \sin (x)-b x \cos (x)-c x^2 \cos (x)+2 c x \sin (x)+2 c \cos (x) \]

[Out]

-a*cos(x)+2*c*cos(x)-b*x*cos(x)-c*x^2*cos(x)+b*sin(x)+2*c*x*sin(x)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 35, normalized size of antiderivative = 1.00, 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} \[ -a \cos (x)+b \sin (x)-b x \cos (x)-c x^2 \cos (x)+2 c x \sin (x)+2 c \cos (x) \]

Antiderivative was successfully verified.

[In]

Int[(a + b*x + c*x^2)*Sin[x],x]

[Out]

-(a*Cos[x]) + 2*c*Cos[x] - b*x*Cos[x] - c*x^2*Cos[x] + b*Sin[x] + 2*c*x*Sin[x]

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]

Rule 6742

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

Rubi steps

\begin {align*} \int \left (a+b x+c x^2\right ) \sin (x) \, dx &=\int \left (a \sin (x)+b x \sin (x)+c x^2 \sin (x)\right ) \, dx\\ &=a \int \sin (x) \, dx+b \int x \sin (x) \, dx+c \int x^2 \sin (x) \, dx\\ &=-a \cos (x)-b x \cos (x)-c x^2 \cos (x)+b \int \cos (x) \, dx+(2 c) \int x \cos (x) \, dx\\ &=-a \cos (x)-b x \cos (x)-c x^2 \cos (x)+b \sin (x)+2 c x \sin (x)-(2 c) \int \sin (x) \, dx\\ &=-a \cos (x)+2 c \cos (x)-b x \cos (x)-c x^2 \cos (x)+b \sin (x)+2 c x \sin (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.04, size = 32, normalized size = 0.91 \[ -a \cos (x)+b \sin (x)-b x \cos (x)-c \left (x^2-2\right ) \cos (x)+2 c x \sin (x) \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*x + c*x^2)*Sin[x],x]

[Out]

-(a*Cos[x]) - b*x*Cos[x] - c*(-2 + x^2)*Cos[x] + b*Sin[x] + 2*c*x*Sin[x]

________________________________________________________________________________________

fricas [A]  time = 0.59, size = 27, normalized size = 0.77 \[ -{\left (c x^{2} + b x + a - 2 \, c\right )} \cos \relax (x) + {\left (2 \, c x + b\right )} \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*x^2+b*x+a)*sin(x),x, algorithm="fricas")

[Out]

-(c*x^2 + b*x + a - 2*c)*cos(x) + (2*c*x + b)*sin(x)

________________________________________________________________________________________

giac [A]  time = 0.12, size = 27, normalized size = 0.77 \[ -{\left (c x^{2} + b x + a - 2 \, c\right )} \cos \relax (x) + {\left (2 \, c x + b\right )} \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*x^2+b*x+a)*sin(x),x, algorithm="giac")

[Out]

-(c*x^2 + b*x + a - 2*c)*cos(x) + (2*c*x + b)*sin(x)

________________________________________________________________________________________

maple [A]  time = 0.03, size = 36, normalized size = 1.03 \[ c \left (-x^{2} \cos \relax (x )+2 \cos \relax (x )+2 x \sin \relax (x )\right )+b \left (\sin \relax (x )-x \cos \relax (x )\right )-a \cos \relax (x ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c*x^2+b*x+a)*sin(x),x)

[Out]

c*(-x^2*cos(x)+2*cos(x)+2*x*sin(x))+b*(sin(x)-x*cos(x))-a*cos(x)

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 35, normalized size = 1.00 \[ -{\left (x \cos \relax (x) - \sin \relax (x)\right )} b - {\left ({\left (x^{2} - 2\right )} \cos \relax (x) - 2 \, x \sin \relax (x)\right )} c - a \cos \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*x^2+b*x+a)*sin(x),x, algorithm="maxima")

[Out]

-(x*cos(x) - sin(x))*b - ((x^2 - 2)*cos(x) - 2*x*sin(x))*c - a*cos(x)

________________________________________________________________________________________

mupad [B]  time = 0.06, size = 34, normalized size = 0.97 \[ b\,\sin \relax (x)-\cos \relax (x)\,\left (a-2\,c\right )-b\,x\,\cos \relax (x)+2\,c\,x\,\sin \relax (x)-c\,x^2\,\cos \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)*(a + b*x + c*x^2),x)

[Out]

b*sin(x) - cos(x)*(a - 2*c) - b*x*cos(x) + 2*c*x*sin(x) - c*x^2*cos(x)

________________________________________________________________________________________

sympy [A]  time = 0.33, size = 39, normalized size = 1.11 \[ - a \cos {\relax (x )} - b x \cos {\relax (x )} + b \sin {\relax (x )} - c x^{2} \cos {\relax (x )} + 2 c x \sin {\relax (x )} + 2 c \cos {\relax (x )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*x**2+b*x+a)*sin(x),x)

[Out]

-a*cos(x) - b*x*cos(x) + b*sin(x) - c*x**2*cos(x) + 2*c*x*sin(x) + 2*c*cos(x)

________________________________________________________________________________________