\(\int \cos (x) \sin (a+x) \, dx\) [233]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 7, antiderivative size = 18 \[ \int \cos (x) \sin (a+x) \, dx=-\frac {1}{4} \cos (a+2 x)+\frac {1}{2} x \sin (a) \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {4670, 2718} \[ \int \cos (x) \sin (a+x) \, dx=\frac {1}{2} x \sin (a)-\frac {1}{4} \cos (a+2 x) \]

[In]

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

[Out]

-1/4*Cos[a + 2*x] + (x*Sin[a])/2

Rule 2718

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

Rule 4670

Int[Cos[w_]^(q_.)*Sin[v_]^(p_.), x_Symbol] :> Int[ExpandTrigReduce[Sin[v]^p*Cos[w]^q, x], x] /; IGtQ[p, 0] &&
IGtQ[q, 0] && ((PolynomialQ[v, x] && PolynomialQ[w, x]) || (BinomialQ[{v, w}, x] && IndependentQ[Cancel[v/w],
x]))

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {\sin (a)}{2}+\frac {1}{2} \sin (a+2 x)\right ) \, dx \\ & = \frac {1}{2} x \sin (a)+\frac {1}{2} \int \sin (a+2 x) \, dx \\ & = -\frac {1}{4} \cos (a+2 x)+\frac {1}{2} x \sin (a) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.00 \[ \int \cos (x) \sin (a+x) \, dx=\frac {1}{4} (-\cos (a+2 x)+2 x \sin (a)) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.29 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.83

method result size
default \(-\frac {\cos \left (a +2 x \right )}{4}+\frac {x \sin \left (a \right )}{2}\) \(15\)
risch \(-\frac {\cos \left (a +2 x \right )}{4}+\frac {x \sin \left (a \right )}{2}\) \(15\)
parallelrisch \(-\frac {\cos \left (a +2 x \right )}{4}+\frac {\cos \left (a \right )}{4}+\frac {x \sin \left (a \right )}{2}\) \(19\)
norman \(\frac {x \tan \left (\frac {a}{2}+\frac {x}{2}\right )+x \tan \left (\frac {x}{2}\right ) \left (\tan ^{2}\left (\frac {a}{2}+\frac {x}{2}\right )\right )+2 \tan \left (\frac {x}{2}\right ) \tan \left (\frac {a}{2}+\frac {x}{2}\right )-x \tan \left (\frac {x}{2}\right )-x \left (\tan ^{2}\left (\frac {x}{2}\right )\right ) \tan \left (\frac {a}{2}+\frac {x}{2}\right )}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right ) \left (1+\tan ^{2}\left (\frac {a}{2}+\frac {x}{2}\right )\right )}\) \(91\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.56 \[ \int \cos (x) \sin (a+x) \, dx=-\frac {1}{2} \, \cos \left (a + x\right )^{2} \cos \left (a\right ) - \frac {1}{2} \, \cos \left (a + x\right ) \sin \left (a + x\right ) \sin \left (a\right ) + \frac {1}{2} \, x \sin \left (a\right ) \]

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 32 vs. \(2 (14) = 28\).

Time = 0.13 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.78 \[ \int \cos (x) \sin (a+x) \, dx=- \frac {x \sin {\left (x \right )} \cos {\left (a + x \right )}}{2} + \frac {x \sin {\left (a + x \right )} \cos {\left (x \right )}}{2} - \frac {\cos {\left (x \right )} \cos {\left (a + x \right )}}{2} \]

[In]

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

[Out]

-x*sin(x)*cos(a + x)/2 + x*sin(a + x)*cos(x)/2 - cos(x)*cos(a + x)/2

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.78 \[ \int \cos (x) \sin (a+x) \, dx=\frac {1}{2} \, x \sin \left (a\right ) - \frac {1}{4} \, \cos \left (a + 2 \, x\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.78 \[ \int \cos (x) \sin (a+x) \, dx=\frac {1}{2} \, x \sin \left (a\right ) - \frac {1}{4} \, \cos \left (a + 2 \, x\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.78 \[ \int \cos (x) \sin (a+x) \, dx=\frac {x\,\sin \left (a\right )}{2}-\frac {\cos \left (a+2\,x\right )}{4} \]

[In]

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

[Out]

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