Integrand size = 23, antiderivative size = 107 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\frac {1}{2} \left (2 a^2 A+A b^2+2 a b B\right ) x+\frac {2 \left (3 a A b+a^2 B+b^2 B\right ) \sin (c+d x)}{3 d}+\frac {b (3 A b+2 a B) \cos (c+d x) \sin (c+d x)}{6 d}+\frac {B (a+b \cos (c+d x))^2 \sin (c+d x)}{3 d} \] Output:
1/2*(2*A*a^2+A*b^2+2*B*a*b)*x+2/3*(3*A*a*b+B*a^2+B*b^2)*sin(d*x+c)/d+1/6*b *(3*A*b+2*B*a)*cos(d*x+c)*sin(d*x+c)/d+1/3*B*(a+b*cos(d*x+c))^2*sin(d*x+c) /d
Time = 1.04 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.84 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\frac {6 \left (2 a^2 A+A b^2+2 a b B\right ) (c+d x)+3 \left (8 a A b+4 a^2 B+3 b^2 B\right ) \sin (c+d x)+3 b (A b+2 a B) \sin (2 (c+d x))+b^2 B \sin (3 (c+d x))}{12 d} \] Input:
Integrate[(a + b*Cos[c + d*x])^2*(A + B*Cos[c + d*x]),x]
Output:
(6*(2*a^2*A + A*b^2 + 2*a*b*B)*(c + d*x) + 3*(8*a*A*b + 4*a^2*B + 3*b^2*B) *Sin[c + d*x] + 3*b*(A*b + 2*a*B)*Sin[2*(c + d*x)] + b^2*B*Sin[3*(c + d*x) ])/(12*d)
Time = 0.36 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.03, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3042, 3232, 3042, 3213}
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 (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx\) |
\(\Big \downarrow \) 3232 |
\(\displaystyle \frac {1}{3} \int (a+b \cos (c+d x)) (3 a A+2 b B+(3 A b+2 a B) \cos (c+d x))dx+\frac {B \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{3} \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right ) \left (3 a A+2 b B+(3 A b+2 a B) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {B \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\) |
\(\Big \downarrow \) 3213 |
\(\displaystyle \frac {1}{3} \left (\frac {2 \left (a^2 B+3 a A b+b^2 B\right ) \sin (c+d x)}{d}+\frac {3}{2} x \left (2 a^2 A+2 a b B+A b^2\right )+\frac {b (2 a B+3 A b) \sin (c+d x) \cos (c+d x)}{2 d}\right )+\frac {B \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\) |
Input:
Int[(a + b*Cos[c + d*x])^2*(A + B*Cos[c + d*x]),x]
Output:
(B*(a + b*Cos[c + d*x])^2*Sin[c + d*x])/(3*d) + ((3*(2*a^2*A + A*b^2 + 2*a *b*B)*x)/2 + (2*(3*a*A*b + a^2*B + b^2*B)*Sin[c + d*x])/d + (b*(3*A*b + 2* a*B)*Cos[c + d*x]*Sin[c + d*x])/(2*d))/3
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) *(x_)]), x_Symbol] :> Simp[(2*a*c + b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Co s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-d)*Cos[e + f*x]*((a + b*Sin[e + f*x])^m/( f*(m + 1))), x] + Simp[1/(m + 1) Int[(a + b*Sin[e + f*x])^(m - 1)*Simp[b* d*m + a*c*(m + 1) + (a*d*m + b*c*(m + 1))*Sin[e + f*x], x], x], x] /; FreeQ [{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 0] && IntegerQ[2*m]
Time = 1.68 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.07
\[\frac {a^{2} A \left (d x +c \right )+a^{2} B \sin \left (d x +c \right )+2 A \sin \left (d x +c \right ) a b +2 B a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+A \,b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+\frac {B \,b^{2} \left (\cos \left (d x +c \right )^{2}+2\right ) \sin \left (d x +c \right )}{3}}{d}\]
Input:
int((a+cos(d*x+c)*b)^2*(A+B*cos(d*x+c)),x)
Output:
1/d*(a^2*A*(d*x+c)+a^2*B*sin(d*x+c)+2*A*sin(d*x+c)*a*b+2*B*a*b*(1/2*cos(d* x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+A*b^2*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/ 2*c)+1/3*B*b^2*(cos(d*x+c)^2+2)*sin(d*x+c))
Time = 0.08 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.79 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\frac {3 \, {\left (2 \, A a^{2} + 2 \, B a b + A b^{2}\right )} d x + {\left (2 \, B b^{2} \cos \left (d x + c\right )^{2} + 6 \, B a^{2} + 12 \, A a b + 4 \, B b^{2} + 3 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, d} \] Input:
integrate((a+b*cos(d*x+c))^2*(A+B*cos(d*x+c)),x, algorithm="fricas")
Output:
1/6*(3*(2*A*a^2 + 2*B*a*b + A*b^2)*d*x + (2*B*b^2*cos(d*x + c)^2 + 6*B*a^2 + 12*A*a*b + 4*B*b^2 + 3*(2*B*a*b + A*b^2)*cos(d*x + c))*sin(d*x + c))/d
Time = 0.16 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.86 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\begin {cases} A a^{2} x + \frac {2 A a b \sin {\left (c + d x \right )}}{d} + \frac {A b^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {A b^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {A b^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {B a^{2} \sin {\left (c + d x \right )}}{d} + B a b x \sin ^{2}{\left (c + d x \right )} + B a b x \cos ^{2}{\left (c + d x \right )} + \frac {B a b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{d} + \frac {2 B b^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {B b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\left (c \right )}\right ) \left (a + b \cos {\left (c \right )}\right )^{2} & \text {otherwise} \end {cases} \] Input:
integrate((a+b*cos(d*x+c))**2*(A+B*cos(d*x+c)),x)
Output:
Piecewise((A*a**2*x + 2*A*a*b*sin(c + d*x)/d + A*b**2*x*sin(c + d*x)**2/2 + A*b**2*x*cos(c + d*x)**2/2 + A*b**2*sin(c + d*x)*cos(c + d*x)/(2*d) + B* a**2*sin(c + d*x)/d + B*a*b*x*sin(c + d*x)**2 + B*a*b*x*cos(c + d*x)**2 + B*a*b*sin(c + d*x)*cos(c + d*x)/d + 2*B*b**2*sin(c + d*x)**3/(3*d) + B*b** 2*sin(c + d*x)*cos(c + d*x)**2/d, Ne(d, 0)), (x*(A + B*cos(c))*(a + b*cos( c))**2, True))
Time = 0.04 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.01 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\frac {12 \, {\left (d x + c\right )} A a^{2} + 6 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a b + 3 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A b^{2} - 4 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B b^{2} + 12 \, B a^{2} \sin \left (d x + c\right ) + 24 \, A a b \sin \left (d x + c\right )}{12 \, d} \] Input:
integrate((a+b*cos(d*x+c))^2*(A+B*cos(d*x+c)),x, algorithm="maxima")
Output:
1/12*(12*(d*x + c)*A*a^2 + 6*(2*d*x + 2*c + sin(2*d*x + 2*c))*B*a*b + 3*(2 *d*x + 2*c + sin(2*d*x + 2*c))*A*b^2 - 4*(sin(d*x + c)^3 - 3*sin(d*x + c)) *B*b^2 + 12*B*a^2*sin(d*x + c) + 24*A*a*b*sin(d*x + c))/d
Time = 0.20 (sec) , antiderivative size = 93, normalized size of antiderivative = 0.87 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\frac {B b^{2} \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {1}{2} \, {\left (2 \, A a^{2} + 2 \, B a b + A b^{2}\right )} x + \frac {{\left (2 \, B a b + A b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} \sin \left (d x + c\right )}{4 \, d} \] Input:
integrate((a+b*cos(d*x+c))^2*(A+B*cos(d*x+c)),x, algorithm="giac")
Output:
1/12*B*b^2*sin(3*d*x + 3*c)/d + 1/2*(2*A*a^2 + 2*B*a*b + A*b^2)*x + 1/4*(2 *B*a*b + A*b^2)*sin(2*d*x + 2*c)/d + 1/4*(4*B*a^2 + 8*A*a*b + 3*B*b^2)*sin (d*x + c)/d
Time = 40.95 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.07 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=A\,a^2\,x+\frac {A\,b^2\,x}{2}+\frac {B\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {3\,B\,b^2\,\sin \left (c+d\,x\right )}{4\,d}+B\,a\,b\,x+\frac {A\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {2\,A\,a\,b\,\sin \left (c+d\,x\right )}{d}+\frac {B\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{2\,d} \] Input:
int((A + B*cos(c + d*x))*(a + b*cos(c + d*x))^2,x)
Output:
A*a^2*x + (A*b^2*x)/2 + (B*a^2*sin(c + d*x))/d + (3*B*b^2*sin(c + d*x))/(4 *d) + B*a*b*x + (A*b^2*sin(2*c + 2*d*x))/(4*d) + (B*b^2*sin(3*c + 3*d*x))/ (12*d) + (2*A*a*b*sin(c + d*x))/d + (B*a*b*sin(2*c + 2*d*x))/(2*d)
Time = 0.17 (sec) , antiderivative size = 75, normalized size of antiderivative = 0.70 \[ \int (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx=\frac {9 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a \,b^{2}-2 \sin \left (d x +c \right )^{3} b^{3}+18 \sin \left (d x +c \right ) a^{2} b +6 \sin \left (d x +c \right ) b^{3}+6 a^{3} d x +9 a \,b^{2} d x}{6 d} \] Input:
int((a+b*cos(d*x+c))^2*(A+B*cos(d*x+c)),x)
Output:
(9*cos(c + d*x)*sin(c + d*x)*a*b**2 - 2*sin(c + d*x)**3*b**3 + 18*sin(c + d*x)*a**2*b + 6*sin(c + d*x)*b**3 + 6*a**3*d*x + 9*a*b**2*d*x)/(6*d)