\(\int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx\) [453]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 31, antiderivative size = 196 \[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=\frac {b B (c \cos (e+f x))^{1+m} \sin (e+f x)}{c f (2+m)}-\frac {(b B (1+m)+a A (2+m)) (c \cos (e+f x))^{1+m} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+m}{2},\frac {3+m}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{c f (1+m) (2+m) \sqrt {\sin ^2(e+f x)}}-\frac {(A b+a B) (c \cos (e+f x))^{2+m} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+m}{2},\frac {4+m}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{c^2 f (2+m) \sqrt {\sin ^2(e+f x)}} \] Output:

b*B*(c*cos(f*x+e))^(1+m)*sin(f*x+e)/c/f/(2+m)-(b*B*(1+m)+a*A*(2+m))*(c*cos 
(f*x+e))^(1+m)*hypergeom([1/2, 1/2+1/2*m],[3/2+1/2*m],cos(f*x+e)^2)*sin(f* 
x+e)/c/f/(1+m)/(2+m)/(sin(f*x+e)^2)^(1/2)-(A*b+B*a)*(c*cos(f*x+e))^(2+m)*h 
ypergeom([1/2, 1+1/2*m],[2+1/2*m],cos(f*x+e)^2)*sin(f*x+e)/c^2/f/(2+m)/(si 
n(f*x+e)^2)^(1/2)
 

Mathematica [A] (verified)

Time = 0.91 (sec) , antiderivative size = 162, normalized size of antiderivative = 0.83 \[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=-\frac {(c \cos (e+f x))^m \left ((b B (1+m)+a A (2+m)) \cot (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+m}{2},\frac {3+m}{2},\cos ^2(e+f x)\right ) \sqrt {\sin ^2(e+f x)}+(A b+a B) (1+m) \cos (e+f x) \cot (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+m}{2},\frac {4+m}{2},\cos ^2(e+f x)\right ) \sqrt {\sin ^2(e+f x)}-\frac {1}{2} b B (1+m) \sin (2 (e+f x))\right )}{f (1+m) (2+m)} \] Input:

Integrate[(c*Cos[e + f*x])^m*(a + b*Cos[e + f*x])*(A + B*Cos[e + f*x]),x]
 

Output:

-(((c*Cos[e + f*x])^m*((b*B*(1 + m) + a*A*(2 + m))*Cot[e + f*x]*Hypergeome 
tric2F1[1/2, (1 + m)/2, (3 + m)/2, Cos[e + f*x]^2]*Sqrt[Sin[e + f*x]^2] + 
(A*b + a*B)*(1 + m)*Cos[e + f*x]*Cot[e + f*x]*Hypergeometric2F1[1/2, (2 + 
m)/2, (4 + m)/2, Cos[e + f*x]^2]*Sqrt[Sin[e + f*x]^2] - (b*B*(1 + m)*Sin[2 
*(e + f*x)])/2))/(f*(1 + m)*(2 + m)))
 

Rubi [A] (verified)

Time = 0.64 (sec) , antiderivative size = 193, normalized size of antiderivative = 0.98, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {3042, 3447, 3042, 3502, 3042, 3227, 3042, 3122}

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 (e+f x)) (A+B \cos (e+f x)) (c \cos (e+f x))^m \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (a+b \sin \left (e+f x+\frac {\pi }{2}\right )\right ) \left (A+B \sin \left (e+f x+\frac {\pi }{2}\right )\right ) \left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^mdx\)

\(\Big \downarrow \) 3447

\(\displaystyle \int (c \cos (e+f x))^m \left ((a B+A b) \cos (e+f x)+a A+b B \cos ^2(e+f x)\right )dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^m \left ((a B+A b) \sin \left (e+f x+\frac {\pi }{2}\right )+a A+b B \sin \left (e+f x+\frac {\pi }{2}\right )^2\right )dx\)

\(\Big \downarrow \) 3502

\(\displaystyle \frac {\int (c \cos (e+f x))^m (c (b B (m+1)+a A (m+2))+(A b+a B) c (m+2) \cos (e+f x))dx}{c (m+2)}+\frac {b B \sin (e+f x) (c \cos (e+f x))^{m+1}}{c f (m+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^m \left (c (b B (m+1)+a A (m+2))+(A b+a B) c (m+2) \sin \left (e+f x+\frac {\pi }{2}\right )\right )dx}{c (m+2)}+\frac {b B \sin (e+f x) (c \cos (e+f x))^{m+1}}{c f (m+2)}\)

\(\Big \downarrow \) 3227

\(\displaystyle \frac {c (a A (m+2)+b B (m+1)) \int (c \cos (e+f x))^mdx+(m+2) (a B+A b) \int (c \cos (e+f x))^{m+1}dx}{c (m+2)}+\frac {b B \sin (e+f x) (c \cos (e+f x))^{m+1}}{c f (m+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {c (a A (m+2)+b B (m+1)) \int \left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^mdx+(m+2) (a B+A b) \int \left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^{m+1}dx}{c (m+2)}+\frac {b B \sin (e+f x) (c \cos (e+f x))^{m+1}}{c f (m+2)}\)

\(\Big \downarrow \) 3122

\(\displaystyle \frac {-\frac {\sin (e+f x) (a A (m+2)+b B (m+1)) (c \cos (e+f x))^{m+1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m+1}{2},\frac {m+3}{2},\cos ^2(e+f x)\right )}{f (m+1) \sqrt {\sin ^2(e+f x)}}-\frac {(a B+A b) \sin (e+f x) (c \cos (e+f x))^{m+2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m+2}{2},\frac {m+4}{2},\cos ^2(e+f x)\right )}{c f \sqrt {\sin ^2(e+f x)}}}{c (m+2)}+\frac {b B \sin (e+f x) (c \cos (e+f x))^{m+1}}{c f (m+2)}\)

Input:

Int[(c*Cos[e + f*x])^m*(a + b*Cos[e + f*x])*(A + B*Cos[e + f*x]),x]
 

Output:

(b*B*(c*Cos[e + f*x])^(1 + m)*Sin[e + f*x])/(c*f*(2 + m)) + (-(((b*B*(1 + 
m) + a*A*(2 + m))*(c*Cos[e + f*x])^(1 + m)*Hypergeometric2F1[1/2, (1 + m)/ 
2, (3 + m)/2, Cos[e + f*x]^2]*Sin[e + f*x])/(f*(1 + m)*Sqrt[Sin[e + f*x]^2 
])) - ((A*b + a*B)*(c*Cos[e + f*x])^(2 + m)*Hypergeometric2F1[1/2, (2 + m) 
/2, (4 + m)/2, Cos[e + f*x]^2]*Sin[e + f*x])/(c*f*Sqrt[Sin[e + f*x]^2]))/( 
c*(2 + m))
 

Defintions of rubi rules used

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

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 3447
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Int[(a 
 + b*Sin[e + f*x])^m*(A*c + (B*c + A*d)*Sin[e + f*x] + B*d*Sin[e + f*x]^2), 
 x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0]
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 
Maple [F]

\[\int \left (c \cos \left (f x +e \right )\right )^{m} \left (a +\cos \left (f x +e \right ) b \right ) \left (A +B \cos \left (f x +e \right )\right )d x\]

Input:

int((c*cos(f*x+e))^m*(a+cos(f*x+e)*b)*(A+B*cos(f*x+e)),x)
 

Output:

int((c*cos(f*x+e))^m*(a+cos(f*x+e)*b)*(A+B*cos(f*x+e)),x)
 

Fricas [F]

\[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=\int { {\left (B \cos \left (f x + e\right ) + A\right )} {\left (b \cos \left (f x + e\right ) + a\right )} \left (c \cos \left (f x + e\right )\right )^{m} \,d x } \] Input:

integrate((c*cos(f*x+e))^m*(a+b*cos(f*x+e))*(A+B*cos(f*x+e)),x, algorithm= 
"fricas")
 

Output:

integral((B*b*cos(f*x + e)^2 + A*a + (B*a + A*b)*cos(f*x + e))*(c*cos(f*x 
+ e))^m, x)
 

Sympy [F]

\[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=\int \left (c \cos {\left (e + f x \right )}\right )^{m} \left (A + B \cos {\left (e + f x \right )}\right ) \left (a + b \cos {\left (e + f x \right )}\right )\, dx \] Input:

integrate((c*cos(f*x+e))**m*(a+b*cos(f*x+e))*(A+B*cos(f*x+e)),x)
 

Output:

Integral((c*cos(e + f*x))**m*(A + B*cos(e + f*x))*(a + b*cos(e + f*x)), x)
 

Maxima [F]

\[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=\int { {\left (B \cos \left (f x + e\right ) + A\right )} {\left (b \cos \left (f x + e\right ) + a\right )} \left (c \cos \left (f x + e\right )\right )^{m} \,d x } \] Input:

integrate((c*cos(f*x+e))^m*(a+b*cos(f*x+e))*(A+B*cos(f*x+e)),x, algorithm= 
"maxima")
 

Output:

integrate((B*cos(f*x + e) + A)*(b*cos(f*x + e) + a)*(c*cos(f*x + e))^m, x)
 

Giac [F]

\[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=\int { {\left (B \cos \left (f x + e\right ) + A\right )} {\left (b \cos \left (f x + e\right ) + a\right )} \left (c \cos \left (f x + e\right )\right )^{m} \,d x } \] Input:

integrate((c*cos(f*x+e))^m*(a+b*cos(f*x+e))*(A+B*cos(f*x+e)),x, algorithm= 
"giac")
 

Output:

integrate((B*cos(f*x + e) + A)*(b*cos(f*x + e) + a)*(c*cos(f*x + e))^m, x)
 

Mupad [F(-1)]

Timed out. \[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=\int {\left (c\,\cos \left (e+f\,x\right )\right )}^m\,\left (A+B\,\cos \left (e+f\,x\right )\right )\,\left (a+b\,\cos \left (e+f\,x\right )\right ) \,d x \] Input:

int((c*cos(e + f*x))^m*(A + B*cos(e + f*x))*(a + b*cos(e + f*x)),x)
 

Output:

int((c*cos(e + f*x))^m*(A + B*cos(e + f*x))*(a + b*cos(e + f*x)), x)
 

Reduce [F]

\[ \int (c \cos (e+f x))^m (a+b \cos (e+f x)) (A+B \cos (e+f x)) \, dx=c^{m} \left (\left (\int \cos \left (f x +e \right )^{m}d x \right ) a^{2}+2 \left (\int \cos \left (f x +e \right )^{m} \cos \left (f x +e \right )d x \right ) a b +\left (\int \cos \left (f x +e \right )^{m} \cos \left (f x +e \right )^{2}d x \right ) b^{2}\right ) \] Input:

int((c*cos(f*x+e))^m*(a+b*cos(f*x+e))*(A+B*cos(f*x+e)),x)
 

Output:

c**m*(int(cos(e + f*x)**m,x)*a**2 + 2*int(cos(e + f*x)**m*cos(e + f*x),x)* 
a*b + int(cos(e + f*x)**m*cos(e + f*x)**2,x)*b**2)