3.100 \(\int \cos (x) \sin (m x) \, dx\)

Optimal. Leaf size=35 \[ \frac {\cos ((1-m) x)}{2 (1-m)}-\frac {\cos ((m+1) x)}{2 (m+1)} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, integrand size = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {4574, 2638} \[ \frac {\cos ((1-m) x)}{2 (1-m)}-\frac {\cos ((m+1) x)}{2 (m+1)} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 2638

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

Rule 4574

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*} \int \cos (x) \sin (m x) \, dx &=\int \left (-\frac {1}{2} \sin ((1-m) x)+\frac {1}{2} \sin ((1+m) x)\right ) \, dx\\ &=-\left (\frac {1}{2} \int \sin ((1-m) x) \, dx\right )+\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]  time = 0.05, size = 26, normalized size = 0.74 \[ \frac {\sin (x) \sin (m x)+m \cos (x) \cos (m x)}{1-m^2} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.43, size = 25, normalized size = 0.71 \[ -\frac {m \cos \left (m x\right ) \cos \relax (x) + \sin \left (m x\right ) \sin \relax (x)}{m^{2} - 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.14, size = 29, normalized size = 0.83 \[ -\frac {\cos \left (m x + x\right )}{2 \, {\left (m + 1\right )}} - \frac {\cos \left (m x - x\right )}{2 \, {\left (m - 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.02, size = 28, normalized size = 0.80 \[ -\frac {\cos \left (\left (-1+m \right ) x \right )}{2 \left (-1+m \right )}-\frac {\cos \left (\left (1+m \right ) x \right )}{2 \left (1+m \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 27, normalized size = 0.77 \[ -\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 )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 2.29, size = 57, normalized size = 1.63 \[ \left \{\begin {array}{cl} \frac {{\sin \relax (x)}^2}{2} & \text {\ if\ \ }m=1\\ \frac {{\cos \relax (x)}^2}{2} & \text {\ if\ \ }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 . \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.78, size = 44, normalized size = 1.26 \[ \begin {cases} - \frac {\sin ^{2}{\relax (x )}}{2} & \text {for}\: m = -1 \\\frac {\sin ^{2}{\relax (x )}}{2} & \text {for}\: m = 1 \\- \frac {m \cos {\relax (x )} \cos {\left (m x \right )}}{m^{2} - 1} - \frac {\sin {\relax (x )} \sin {\left (m x \right )}}{m^{2} - 1} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Piecewise((-sin(x)**2/2, Eq(m, -1)), (sin(x)**2/2, Eq(m, 1)), (-m*cos(x)*cos(m*x)/(m**2 - 1) - sin(x)*sin(m*x)
/(m**2 - 1), True))

________________________________________________________________________________________