\(\int \cos ^2(c+d x) \sin (a+b x) \, dx\) [186]

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

Optimal result

Integrand size = 15, antiderivative size = 62 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=-\frac {\cos (a+b x)}{2 b}-\frac {\cos (a-2 c+(b-2 d) x)}{4 (b-2 d)}-\frac {\cos (a+2 c+(b+2 d) x)}{4 (b+2 d)} \] Output:

-1/2*cos(b*x+a)/b-cos(a-2*c+(b-2*d)*x)/(4*b-8*d)-cos(a+2*c+(b+2*d)*x)/(4*b 
+8*d)
 

Mathematica [A] (verified)

Time = 0.52 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.15 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=\frac {1}{4} \left (-\frac {2 \cos (a) \cos (b x)}{b}-\frac {\cos (a-2 c+b x-2 d x)}{b-2 d}-\frac {\cos (a+2 c+b x+2 d x)}{b+2 d}+\frac {2 \sin (a) \sin (b x)}{b}\right ) \] Input:

Integrate[Cos[c + d*x]^2*Sin[a + b*x],x]
 

Output:

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

Rubi [A] (verified)

Time = 0.24 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {5085, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sin (a+b x) \cos ^2(c+d x) \, dx\)

\(\Big \downarrow \) 5085

\(\displaystyle \int \left (\frac {1}{4} \sin (a+x (b-2 d)-2 c)+\frac {1}{4} \sin (a+x (b+2 d)+2 c)+\frac {1}{2} \sin (a+b x)\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {\cos (a+x (b-2 d)-2 c)}{4 (b-2 d)}-\frac {\cos (a+x (b+2 d)+2 c)}{4 (b+2 d)}-\frac {\cos (a+b x)}{2 b}\)

Input:

Int[Cos[c + d*x]^2*Sin[a + b*x],x]
 

Output:

-1/2*Cos[a + b*x]/b - Cos[a - 2*c + (b - 2*d)*x]/(4*(b - 2*d)) - Cos[a + 2 
*c + (b + 2*d)*x]/(4*(b + 2*d))
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 5085
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] && Pol 
ynomialQ[w, x]) || (BinomialQ[{v, w}, x] && IndependentQ[Cancel[v/w], x]))
 
Maple [A] (verified)

Time = 1.74 (sec) , antiderivative size = 57, normalized size of antiderivative = 0.92

method result size
default \(-\frac {\cos \left (b x +a \right )}{2 b}-\frac {\cos \left (a -2 c +\left (b -2 d \right ) x \right )}{4 \left (b -2 d \right )}-\frac {\cos \left (a +2 c +\left (b +2 d \right ) x \right )}{4 \left (b +2 d \right )}\) \(57\)
risch \(-\frac {\cos \left (b x +a \right )}{2 b}-\frac {\cos \left (b x -2 d x +a -2 c \right )}{4 \left (b -2 d \right )}-\frac {\cos \left (b x +2 d x +a +2 c \right )}{4 \left (b +2 d \right )}\) \(57\)
parallelrisch \(\frac {-b \left (b +2 d \right ) \cos \left (a -2 c +\left (b -2 d \right ) x \right )-b \left (b -2 d \right ) \cos \left (a +2 c +\left (b +2 d \right ) x \right )+\left (-2 b^{2}+8 d^{2}\right ) \cos \left (b x +a \right )-4 b^{2}+8 d^{2}}{4 b^{3}-16 b \,d^{2}}\) \(87\)
norman \(\frac {\frac {-2 b^{2}+4 d^{2}}{b \left (b^{2}-4 d^{2}\right )}+\frac {\left (-2 b^{2}+4 d^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{b \left (b^{2}-4 d^{2}\right )}+\frac {8 d^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{b \left (b^{2}-4 d^{2}\right )}-\frac {8 d \tan \left (\frac {a}{2}+\frac {b x}{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{b^{2}-4 d^{2}}+\frac {8 d \tan \left (\frac {a}{2}+\frac {b x}{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{b^{2}-4 d^{2}}-\frac {4 b \tan \left (\frac {a}{2}+\frac {b x}{2}\right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{b^{2}-4 d^{2}}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (1+\tan \left (\frac {a}{2}+\frac {b x}{2}\right )^{2}\right )}\) \(228\)
orering \(-\frac {\left (3 b^{4}+16 d^{4}\right ) \left (-2 \sin \left (b x +a \right ) \sin \left (d x +c \right ) d \cos \left (d x +c \right )+\cos \left (d x +c \right )^{2} b \cos \left (b x +a \right )\right )}{b^{2} \left (b^{4}-8 b^{2} d^{2}+16 d^{4}\right )}-\frac {\left (3 b^{2}+8 d^{2}\right ) \left (6 b^{2} \sin \left (b x +a \right ) \cos \left (d x +c \right ) \sin \left (d x +c \right ) d -6 \cos \left (b x +a \right ) \cos \left (d x +c \right )^{2} d^{2} b +6 \cos \left (b x +a \right ) d^{2} \sin \left (d x +c \right )^{2} b +8 \cos \left (d x +c \right ) \sin \left (b x +a \right ) d^{3} \sin \left (d x +c \right )-\cos \left (d x +c \right )^{2} b^{3} \cos \left (b x +a \right )\right )}{b^{2} \left (b^{4}-8 b^{2} d^{2}+16 d^{4}\right )}-\frac {-10 b^{4} \sin \left (b x +a \right ) \cos \left (d x +c \right ) \sin \left (d x +c \right ) d -20 b^{3} \cos \left (b x +a \right ) d^{2} \sin \left (d x +c \right )^{2}+20 b^{3} \cos \left (b x +a \right ) \cos \left (d x +c \right )^{2} d^{2}-80 b^{2} \sin \left (b x +a \right ) \cos \left (d x +c \right ) d^{3} \sin \left (d x +c \right )-40 \cos \left (b x +a \right ) d^{4} \sin \left (d x +c \right )^{2} b +40 \cos \left (d x +c \right )^{2} b \cos \left (b x +a \right ) d^{4}-32 \cos \left (d x +c \right ) \sin \left (b x +a \right ) d^{5} \sin \left (d x +c \right )+\cos \left (d x +c \right )^{2} b^{5} \cos \left (b x +a \right )}{b^{2} \left (b^{4}-8 b^{2} d^{2}+16 d^{4}\right )}\) \(417\)

Input:

int(cos(d*x+c)^2*sin(b*x+a),x,method=_RETURNVERBOSE)
 

Output:

-1/2*cos(b*x+a)/b-1/4/(b-2*d)*cos(a-2*c+(b-2*d)*x)-1/4/(b+2*d)*cos(a+2*c+( 
b+2*d)*x)
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.06 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=-\frac {b^{2} \cos \left (b x + a\right ) \cos \left (d x + c\right )^{2} + 2 \, b d \cos \left (d x + c\right ) \sin \left (b x + a\right ) \sin \left (d x + c\right ) - 2 \, d^{2} \cos \left (b x + a\right )}{b^{3} - 4 \, b d^{2}} \] Input:

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

Output:

-(b^2*cos(b*x + a)*cos(d*x + c)^2 + 2*b*d*cos(d*x + c)*sin(b*x + a)*sin(d* 
x + c) - 2*d^2*cos(b*x + a))/(b^3 - 4*b*d^2)
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 405 vs. \(2 (51) = 102\).

Time = 0.74 (sec) , antiderivative size = 405, normalized size of antiderivative = 6.53 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=\begin {cases} x \sin {\left (a \right )} \cos ^{2}{\left (c \right )} & \text {for}\: b = 0 \wedge d = 0 \\\left (\frac {x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {\sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d}\right ) \sin {\left (a \right )} & \text {for}\: b = 0 \\- \frac {x \sin {\left (a - 2 d x \right )} \sin ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (a - 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (c + d x \right )} \cos {\left (a - 2 d x \right )} \cos {\left (c + d x \right )}}{2} - \frac {\sin {\left (a - 2 d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} + \frac {\cos {\left (a - 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: b = - 2 d \\- \frac {x \sin {\left (a + 2 d x \right )} \sin ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (a + 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} - \frac {x \sin {\left (c + d x \right )} \cos {\left (a + 2 d x \right )} \cos {\left (c + d x \right )}}{2} - \frac {\sin {\left (a + 2 d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} - \frac {\cos {\left (a + 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: b = 2 d \\- \frac {b^{2} \cos {\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{b^{3} - 4 b d^{2}} - \frac {2 b d \sin {\left (a + b x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 d^{2} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + b x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 d^{2} \cos {\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{b^{3} - 4 b d^{2}} & \text {otherwise} \end {cases} \] Input:

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

Output:

Piecewise((x*sin(a)*cos(c)**2, Eq(b, 0) & Eq(d, 0)), ((x*sin(c + d*x)**2/2 
 + x*cos(c + d*x)**2/2 + sin(c + d*x)*cos(c + d*x)/(2*d))*sin(a), Eq(b, 0) 
), (-x*sin(a - 2*d*x)*sin(c + d*x)**2/4 + x*sin(a - 2*d*x)*cos(c + d*x)**2 
/4 + x*sin(c + d*x)*cos(a - 2*d*x)*cos(c + d*x)/2 - sin(a - 2*d*x)*sin(c + 
 d*x)*cos(c + d*x)/(4*d) + cos(a - 2*d*x)*cos(c + d*x)**2/(2*d), Eq(b, -2* 
d)), (-x*sin(a + 2*d*x)*sin(c + d*x)**2/4 + x*sin(a + 2*d*x)*cos(c + d*x)* 
*2/4 - x*sin(c + d*x)*cos(a + 2*d*x)*cos(c + d*x)/2 - sin(a + 2*d*x)*sin(c 
 + d*x)*cos(c + d*x)/(4*d) - cos(a + 2*d*x)*cos(c + d*x)**2/(2*d), Eq(b, 2 
*d)), (-b**2*cos(a + b*x)*cos(c + d*x)**2/(b**3 - 4*b*d**2) - 2*b*d*sin(a 
+ b*x)*sin(c + d*x)*cos(c + d*x)/(b**3 - 4*b*d**2) + 2*d**2*sin(c + d*x)** 
2*cos(a + b*x)/(b**3 - 4*b*d**2) + 2*d**2*cos(a + b*x)*cos(c + d*x)**2/(b* 
*3 - 4*b*d**2), True))
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 414 vs. \(2 (56) = 112\).

Time = 0.06 (sec) , antiderivative size = 414, normalized size of antiderivative = 6.68 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=-\frac {{\left (b^{2} \cos \left (2 \, c\right ) - 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left ({\left (b + 2 \, d\right )} x + a + 4 \, c\right ) + {\left (b^{2} \cos \left (2 \, c\right ) - 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left ({\left (b + 2 \, d\right )} x + a\right ) + {\left (b^{2} \cos \left (2 \, c\right ) + 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left (-{\left (b - 2 \, d\right )} x - a + 4 \, c\right ) + {\left (b^{2} \cos \left (2 \, c\right ) + 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left (-{\left (b - 2 \, d\right )} x - a\right ) + 2 \, {\left (b^{2} \cos \left (2 \, c\right ) - 4 \, d^{2} \cos \left (2 \, c\right )\right )} \cos \left (b x + a + 2 \, c\right ) + 2 \, {\left (b^{2} \cos \left (2 \, c\right ) - 4 \, d^{2} \cos \left (2 \, c\right )\right )} \cos \left (b x + a - 2 \, c\right ) + {\left (b^{2} \sin \left (2 \, c\right ) - 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left ({\left (b + 2 \, d\right )} x + a + 4 \, c\right ) - {\left (b^{2} \sin \left (2 \, c\right ) - 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left ({\left (b + 2 \, d\right )} x + a\right ) + {\left (b^{2} \sin \left (2 \, c\right ) + 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left (-{\left (b - 2 \, d\right )} x - a + 4 \, c\right ) - {\left (b^{2} \sin \left (2 \, c\right ) + 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left (-{\left (b - 2 \, d\right )} x - a\right ) + 2 \, {\left (b^{2} \sin \left (2 \, c\right ) - 4 \, d^{2} \sin \left (2 \, c\right )\right )} \sin \left (b x + a + 2 \, c\right ) - 2 \, {\left (b^{2} \sin \left (2 \, c\right ) - 4 \, d^{2} \sin \left (2 \, c\right )\right )} \sin \left (b x + a - 2 \, c\right )}{8 \, {\left (b^{3} \cos \left (2 \, c\right )^{2} + b^{3} \sin \left (2 \, c\right )^{2} - 4 \, {\left (b \cos \left (2 \, c\right )^{2} + b \sin \left (2 \, c\right )^{2}\right )} d^{2}\right )}} \] Input:

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

Output:

-1/8*((b^2*cos(2*c) - 2*b*d*cos(2*c))*cos((b + 2*d)*x + a + 4*c) + (b^2*co 
s(2*c) - 2*b*d*cos(2*c))*cos((b + 2*d)*x + a) + (b^2*cos(2*c) + 2*b*d*cos( 
2*c))*cos(-(b - 2*d)*x - a + 4*c) + (b^2*cos(2*c) + 2*b*d*cos(2*c))*cos(-( 
b - 2*d)*x - a) + 2*(b^2*cos(2*c) - 4*d^2*cos(2*c))*cos(b*x + a + 2*c) + 2 
*(b^2*cos(2*c) - 4*d^2*cos(2*c))*cos(b*x + a - 2*c) + (b^2*sin(2*c) - 2*b* 
d*sin(2*c))*sin((b + 2*d)*x + a + 4*c) - (b^2*sin(2*c) - 2*b*d*sin(2*c))*s 
in((b + 2*d)*x + a) + (b^2*sin(2*c) + 2*b*d*sin(2*c))*sin(-(b - 2*d)*x - a 
 + 4*c) - (b^2*sin(2*c) + 2*b*d*sin(2*c))*sin(-(b - 2*d)*x - a) + 2*(b^2*s 
in(2*c) - 4*d^2*sin(2*c))*sin(b*x + a + 2*c) - 2*(b^2*sin(2*c) - 4*d^2*sin 
(2*c))*sin(b*x + a - 2*c))/(b^3*cos(2*c)^2 + b^3*sin(2*c)^2 - 4*(b*cos(2*c 
)^2 + b*sin(2*c)^2)*d^2)
 

Giac [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.90 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=-\frac {\cos \left (b x + 2 \, d x + a + 2 \, c\right )}{4 \, {\left (b + 2 \, d\right )}} - \frac {\cos \left (b x - 2 \, d x + a - 2 \, c\right )}{4 \, {\left (b - 2 \, d\right )}} - \frac {\cos \left (b x + a\right )}{2 \, b} \] Input:

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

Output:

-1/4*cos(b*x + 2*d*x + a + 2*c)/(b + 2*d) - 1/4*cos(b*x - 2*d*x + a - 2*c) 
/(b - 2*d) - 1/2*cos(b*x + a)/b
 

Mupad [B] (verification not implemented)

Time = 17.15 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.56 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=\frac {d\,\left (2\,b\,\cos \left (a-2\,c+b\,x-2\,d\,x\right )-2\,b\,\cos \left (a+2\,c+b\,x+2\,d\,x\right )\right )+b^2\,\cos \left (a-2\,c+b\,x-2\,d\,x\right )+b^2\,\cos \left (a+2\,c+b\,x+2\,d\,x\right )}{16\,b\,d^2-4\,b^3}-\frac {\cos \left (a+b\,x\right )}{2\,b} \] Input:

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

Output:

(d*(2*b*cos(a - 2*c + b*x - 2*d*x) - 2*b*cos(a + 2*c + b*x + 2*d*x)) + b^2 
*cos(a - 2*c + b*x - 2*d*x) + b^2*cos(a + 2*c + b*x + 2*d*x))/(16*b*d^2 - 
4*b^3) - cos(a + b*x)/(2*b)
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.39 \[ \int \cos ^2(c+d x) \sin (a+b x) \, dx=\frac {\cos \left (b x +a \right ) \sin \left (d x +c \right )^{2} b^{2}-\cos \left (b x +a \right ) b^{2}+2 \cos \left (b x +a \right ) d^{2}-2 \cos \left (d x +c \right ) \sin \left (b x +a \right ) \sin \left (d x +c \right ) b d +b^{2}-2 d^{2}}{b \left (b^{2}-4 d^{2}\right )} \] Input:

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

Output:

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