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

Optimal result
Mathematica [A] (verified)
Rubi [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)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 78 \[ \int \cos (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx=\frac {3}{8} a \left (a^2+b^2\right ) x+\frac {3 a (b+a \cot (c+d x)) (a-b \cot (c+d x)) \sin ^2(c+d x)}{8 d}+\frac {(b+a \cot (c+d x))^3 \sin ^4(c+d x)}{4 d} \] Output:

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

Mathematica [A] (verified)

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

Integrate[Cos[c + d*x]*(a*Cos[c + d*x] + b*Sin[c + d*x])^3,x]
 

Output:

(12*a*(a^2 + b^2)*(c + d*x) - 4*(3*a^2*b + b^3)*Cos[2*(c + d*x)] + (-3*a^2 
*b + b^3)*Cos[4*(c + d*x)] + 8*a^3*Sin[2*(c + d*x)] + a*(a^2 - 3*b^2)*Sin[ 
4*(c + d*x)])/(32*d)
 

Rubi [A] (verified)

Time = 0.24 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.22, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3042, 3567, 531, 27, 487, 216}

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 \cos (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3567

\(\displaystyle -\frac {\int \frac {\cot (c+d x) (b+a \cot (c+d x))^3}{\left (\cot ^2(c+d x)+1\right )^3}d\cot (c+d x)}{d}\)

\(\Big \downarrow \) 531

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 487

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

\(\Big \downarrow \) 216

\(\displaystyle -\frac {\frac {3}{4} a \left (\frac {1}{2} \left (a^2+b^2\right ) \arctan (\cot (c+d x))-\frac {(a \cot (c+d x)+b) (a-b \cot (c+d x))}{2 \left (\cot ^2(c+d x)+1\right )}\right )-\frac {(a \cot (c+d x)+b)^3}{4 \left (\cot ^2(c+d x)+1\right )^2}}{d}\)

Input:

Int[Cos[c + d*x]*(a*Cos[c + d*x] + b*Sin[c + d*x])^3,x]
 

Output:

-((-1/4*(b + a*Cot[c + d*x])^3/(1 + Cot[c + d*x]^2)^2 + (3*a*(((a^2 + b^2) 
*ArcTan[Cot[c + d*x]])/2 - ((b + a*Cot[c + d*x])*(a - b*Cot[c + d*x]))/(2* 
(1 + Cot[c + d*x]^2))))/4)/d)
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 487
Int[((c_) + (d_.)*(x_))^(n_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[ 
(c + d*x)^(n - 1)*(a*d - b*c*x)*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + 
 Simp[(2*p + 3)*((b*c^2 + a*d^2)/(2*a*b*(p + 1)))   Int[(c + d*x)^(n - 2)*( 
a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[n + 2*p + 2, 0] 
 && LtQ[p, -1]
 

rule 531
Int[(x_)^(m_.)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symb 
ol] :> With[{Qx = PolynomialQuotient[x^m, a + b*x^2, x], e = Coeff[Polynomi 
alRemainder[x^m, a + b*x^2, x], x, 0], f = Coeff[PolynomialRemainder[x^m, a 
 + b*x^2, x], x, 1]}, Simp[(c + d*x)^n*(a*f - b*e*x)*((a + b*x^2)^(p + 1)/( 
2*a*b*(p + 1))), x] + Simp[1/(2*a*b*(p + 1))   Int[(c + d*x)^(n - 1)*(a + b 
*x^2)^(p + 1)*ExpandToSum[2*a*b*(p + 1)*(c + d*x)*Qx - a*d*f*n + b*c*e*(2*p 
 + 3) + b*d*e*(n + 2*p + 3)*x, x], x], x]] /; FreeQ[{a, b, c, d}, x] && IGt 
Q[n, 0] && IGtQ[m, 0] && LtQ[p, -1] && GtQ[n, 1] && IntegerQ[2*p]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3567
Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*si 
n[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[x^m*((b 
+ a*x)^n/(1 + x^2)^((m + n + 2)/2)), x], x, Cot[c + d*x]], x] /; FreeQ[{a, 
b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[ 
n, 0] && GtQ[m, 1])
 
Maple [A] (verified)

Time = 1.19 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.40

method result size
parallelrisch \(\frac {\left (-12 a^{2} b -4 b^{3}\right ) \cos \left (2 d x +2 c \right )+\left (-3 a^{2} b +b^{3}\right ) \cos \left (4 d x +4 c \right )+\left (a^{3}-3 a \,b^{2}\right ) \sin \left (4 d x +4 c \right )+12 a^{3} d x +12 a \,b^{2} d x +8 \sin \left (2 d x +2 c \right ) a^{3}+15 a^{2} b +3 b^{3}}{32 d}\) \(109\)
derivativedivides \(\frac {a^{3} \left (\frac {\left (\cos \left (d x +c \right )^{3}+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )-\frac {3 a^{2} b \cos \left (d x +c \right )^{4}}{4}+3 a \,b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{3}}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )+\frac {b^{3} \sin \left (d x +c \right )^{4}}{4}}{d}\) \(114\)
default \(\frac {a^{3} \left (\frac {\left (\cos \left (d x +c \right )^{3}+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )-\frac {3 a^{2} b \cos \left (d x +c \right )^{4}}{4}+3 a \,b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{3}}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )+\frac {b^{3} \sin \left (d x +c \right )^{4}}{4}}{d}\) \(114\)
parts \(\frac {a^{3} \left (\frac {\left (\cos \left (d x +c \right )^{3}+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}+\frac {b^{3} \sin \left (d x +c \right )^{4}}{4 d}+\frac {3 a \,b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{3}}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )}{d}-\frac {3 a^{2} b \cos \left (d x +c \right )^{4}}{4 d}\) \(122\)
risch \(\frac {3 a^{3} x}{8}+\frac {3 a \,b^{2} x}{8}-\frac {3 b \cos \left (4 d x +4 c \right ) a^{2}}{32 d}+\frac {b^{3} \cos \left (4 d x +4 c \right )}{32 d}+\frac {a^{3} \sin \left (4 d x +4 c \right )}{32 d}-\frac {3 a \sin \left (4 d x +4 c \right ) b^{2}}{32 d}-\frac {3 b \cos \left (2 d x +2 c \right ) a^{2}}{8 d}-\frac {b^{3} \cos \left (2 d x +2 c \right )}{8 d}+\frac {a^{3} \sin \left (2 d x +2 c \right )}{4 d}\) \(137\)
norman \(\frac {\left (\frac {3}{8} a^{3}+\frac {3}{8} a \,b^{2}\right ) x +\left (\frac {3}{2} a^{3}+\frac {3}{2} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (\frac {3}{2} a^{3}+\frac {3}{2} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\left (\frac {3}{8} a^{3}+\frac {3}{8} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (\frac {9}{4} a^{3}+\frac {9}{4} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\frac {4 b^{3} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}+\frac {6 a^{2} b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}+\frac {6 a^{2} b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{d}-\frac {3 a \left (a^{2}-7 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{4 d}+\frac {3 a \left (a^{2}-7 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{4 d}+\frac {a \left (5 a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}-\frac {a \left (5 a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{4 d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{4}}\) \(297\)
orering \(\text {Expression too large to display}\) \(1202\)

Input:

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

Output:

1/32*((-12*a^2*b-4*b^3)*cos(2*d*x+2*c)+(-3*a^2*b+b^3)*cos(4*d*x+4*c)+(a^3- 
3*a*b^2)*sin(4*d*x+4*c)+12*a^3*d*x+12*a*b^2*d*x+8*sin(2*d*x+2*c)*a^3+15*a^ 
2*b+3*b^3)/d
 

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 272 vs. \(2 (71) = 142\).

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

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

Output:

Piecewise((3*a**3*x*sin(c + d*x)**4/8 + 3*a**3*x*sin(c + d*x)**2*cos(c + d 
*x)**2/4 + 3*a**3*x*cos(c + d*x)**4/8 + 3*a**3*sin(c + d*x)**3*cos(c + d*x 
)/(8*d) + 5*a**3*sin(c + d*x)*cos(c + d*x)**3/(8*d) - 3*a**2*b*cos(c + d*x 
)**4/(4*d) + 3*a*b**2*x*sin(c + d*x)**4/8 + 3*a*b**2*x*sin(c + d*x)**2*cos 
(c + d*x)**2/4 + 3*a*b**2*x*cos(c + d*x)**4/8 + 3*a*b**2*sin(c + d*x)**3*c 
os(c + d*x)/(8*d) - 3*a*b**2*sin(c + d*x)*cos(c + d*x)**3/(8*d) + b**3*sin 
(c + d*x)**4/(4*d), Ne(d, 0)), (x*(a*cos(c) + b*sin(c))**3*cos(c), True))
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 19.02 (sec) , antiderivative size = 281, normalized size of antiderivative = 3.60 \[ \int \cos (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx=\frac {4\,b^3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {3\,a\,b^2}{4}-\frac {5\,a^3}{4}\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7\,\left (\frac {3\,a\,b^2}{4}-\frac {5\,a^3}{4}\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (\frac {21\,a\,b^2}{4}-\frac {3\,a^3}{4}\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,\left (\frac {21\,a\,b^2}{4}-\frac {3\,a^3}{4}\right )+6\,a^2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+6\,a^2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8+4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {3\,a\,\left (\mathrm {atan}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )-\frac {d\,x}{2}\right )\,\left (a^2+b^2\right )}{4\,d}+\frac {3\,a\,\mathrm {atan}\left (\frac {3\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^2+b^2\right )}{4\,\left (\frac {3\,a^3}{4}+\frac {3\,a\,b^2}{4}\right )}\right )\,\left (a^2+b^2\right )}{4\,d} \] Input:

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

Output:

(4*b^3*tan(c/2 + (d*x)/2)^4 - tan(c/2 + (d*x)/2)*((3*a*b^2)/4 - (5*a^3)/4) 
 + tan(c/2 + (d*x)/2)^7*((3*a*b^2)/4 - (5*a^3)/4) + tan(c/2 + (d*x)/2)^3*( 
(21*a*b^2)/4 - (3*a^3)/4) - tan(c/2 + (d*x)/2)^5*((21*a*b^2)/4 - (3*a^3)/4 
) + 6*a^2*b*tan(c/2 + (d*x)/2)^2 + 6*a^2*b*tan(c/2 + (d*x)/2)^6)/(d*(4*tan 
(c/2 + (d*x)/2)^2 + 6*tan(c/2 + (d*x)/2)^4 + 4*tan(c/2 + (d*x)/2)^6 + tan( 
c/2 + (d*x)/2)^8 + 1)) - (3*a*(atan(tan(c/2 + (d*x)/2)) - (d*x)/2)*(a^2 + 
b^2))/(4*d) + (3*a*atan((3*a*tan(c/2 + (d*x)/2)*(a^2 + b^2))/(4*((3*a*b^2) 
/4 + (3*a^3)/4)))*(a^2 + b^2))/(4*d)
 

Reduce [B] (verification not implemented)

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

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

Output:

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