\(\int \cos (m x) \sin (x) \, dx\) [73]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (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 = 35 \[ \int \cos (m x) \sin (x) \, dx=-\frac {\cos ((1-m) x)}{2 (1-m)}-\frac {\cos ((1+m) x)}{2 (1+m)} \]

[Out]

-1/2*cos((1-m)*x)/(1-m)-1/2*cos((1+m)*x)/(1+m)

Rubi [A] (verified)

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

[In]

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

[Out]

-1/2*Cos[(1 - m)*x]/(1 - m) - Cos[(1 + m)*x]/(2*(1 + m))

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 {1}{2} \sin ((1-m) x)+\frac {1}{2} \sin ((1+m) x)\right ) \, dx \\ & = \frac {1}{2} \int \sin ((1-m) x) \, dx+\frac {1}{2} \int \sin ((1+m) x) \, dx \\ & = -\frac {\cos ((1-m) x)}{2 (1-m)}-\frac {\cos ((1+m) x)}{2 (1+m)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.69 \[ \int \cos (m x) \sin (x) \, dx=\frac {\cos (x) \cos (m x)+m \sin (x) \sin (m x)}{-1+m^2} \]

[In]

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

[Out]

(Cos[x]*Cos[m*x] + m*Sin[x]*Sin[m*x])/(-1 + m^2)

Maple [A] (verified)

Time = 0.68 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.80

method result size
default \(\frac {\cos \left (x \left (-1+m \right )\right )}{-2+2 m}-\frac {\cos \left (\left (1+m \right ) x \right )}{2 \left (1+m \right )}\) \(28\)
parallelrisch \(\frac {\left (1+m \right ) \cos \left (x \left (-1+m \right )\right )-2+\left (1-m \right ) \cos \left (\left (1+m \right ) x \right )}{2 m^{2}-2}\) \(35\)
risch \(\frac {\cos \left (x \left (-1+m \right )\right )}{-2+2 m}+\frac {\cos \left (\left (1+m \right ) x \right )}{2 \left (1+m \right ) \left (-1+m \right )}-\frac {\cos \left (\left (1+m \right ) x \right ) m}{2 \left (1+m \right ) \left (-1+m \right )}\) \(52\)
norman \(\frac {-\frac {2 \tan \left (\frac {x}{2}\right )^{2}}{m^{2}-1}-\frac {2 \tan \left (\frac {m x}{2}\right )^{2}}{m^{2}-1}+\frac {4 m \tan \left (\frac {x}{2}\right ) \tan \left (\frac {m x}{2}\right )}{m^{2}-1}}{\left (1+\tan \left (\frac {x}{2}\right )^{2}\right ) \left (1+\tan \left (\frac {m x}{2}\right )^{2}\right )}\) \(74\)

[In]

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

[Out]

1/2/(-1+m)*cos(x*(-1+m))-1/2*cos((1+m)*x)/(1+m)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.69 \[ \int \cos (m x) \sin (x) \, dx=\frac {m \sin \left (m x\right ) \sin \left (x\right ) + \cos \left (m x\right ) \cos \left (x\right )}{m^{2} - 1} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.06 \[ \int \cos (m x) \sin (x) \, dx=\begin {cases} \frac {\sin ^{2}{\left (x \right )}}{2} & \text {for}\: m = -1 \vee m = 1 \\\frac {m \sin {\left (x \right )} \sin {\left (m x \right )}}{m^{2} - 1} + \frac {\cos {\left (x \right )} \cos {\left (m x \right )}}{m^{2} - 1} & \text {otherwise} \end {cases} \]

[In]

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

[Out]

Piecewise((sin(x)**2/2, Eq(m, -1) | Eq(m, 1)), (m*sin(x)*sin(m*x)/(m**2 - 1) + cos(x)*cos(m*x)/(m**2 - 1), Tru
e))

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

-1/2*cos((m + 1)*x)/(m + 1) + 1/2*cos(-(m - 1)*x)/(m - 1)

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

-1/2*cos(m*x + x)/(m + 1) + 1/2*cos(m*x - x)/(m - 1)

Mupad [B] (verification not implemented)

Time = 26.46 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.57 \[ \int \cos (m x) \sin (x) \, dx=\left \{\begin {array}{cl} \frac {{\sin \left (x\right )}^2}{2} & \text {\ if\ \ }m=-1\vee m=1\\ \frac {\cos \left (x\,\left (m-1\right )\right )}{2\,m-2}-\frac {\cos \left (x\,\left (m+1\right )\right )}{2\,m+2} & \text {\ if\ \ }m\neq -1\wedge m\neq 1 \end {array}\right . \]

[In]

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

[Out]

piecewise(m == -1 | m == 1, sin(x)^2/2, m ~= -1 & m ~= 1, cos(x*(m - 1))/(2*m - 2) - cos(x*(m + 1))/(2*m + 2))