\(\int (a \cos (e+f x))^m (A+B \cos (e+f x)+C \cos ^2(e+f x)) \, dx\) [238]

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 = 187 \[ \int (a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\frac {C (a \cos (e+f x))^{1+m} \sin (e+f x)}{a f (2+m)}-\frac {(C (1+m)+A (2+m)) (a \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)}{a f (1+m) (2+m) \sqrt {\sin ^2(e+f x)}}-\frac {B (a \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)}{a^2 f (2+m) \sqrt {\sin ^2(e+f x)}} \] Output:

C*(a*cos(f*x+e))^(1+m)*sin(f*x+e)/a/f/(2+m)-(C*(1+m)+A*(2+m))*(a*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)/a 
/f/(1+m)/(2+m)/(sin(f*x+e)^2)^(1/2)-B*(a*cos(f*x+e))^(2+m)*hypergeom([1/2, 
 1+1/2*m],[2+1/2*m],cos(f*x+e)^2)*sin(f*x+e)/a^2/f/(2+m)/(sin(f*x+e)^2)^(1 
/2)
 

Mathematica [A] (verified)

Time = 0.45 (sec) , antiderivative size = 144, normalized size of antiderivative = 0.77 \[ \int (a \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx=\frac {(a \cos (e+f x))^m \cot (e+f x) \left (-\left ((C (1+m)+A (2+m)) \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)}\right )+(1+m) \left (C \sin ^2(e+f x)-B \cos (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)}\right )\right )}{f (1+m) (2+m)} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.53 (sec) , antiderivative size = 184, normalized size of antiderivative = 0.98, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {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 \cos (e+f x))^m \left (A+B \cos (e+f x)+C \cos ^2(e+f x)\right ) \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3502

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3227

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3122

\(\displaystyle \frac {-\frac {(A (m+2)+C (m+1)) \sin (e+f x) (a \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 {B \sin (e+f x) (a \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 )}{a f \sqrt {\sin ^2(e+f x)}}}{a (m+2)}+\frac {C \sin (e+f x) (a \cos (e+f x))^{m+1}}{a f (m+2)}\)

Input:

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

Output:

(C*(a*Cos[e + f*x])^(1 + m)*Sin[e + f*x])/(a*f*(2 + m)) + (-(((C*(1 + m) + 
 A*(2 + m))*(a*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])) - 
(B*(a*Cos[e + f*x])^(2 + m)*Hypergeometric2F1[1/2, (2 + m)/2, (4 + m)/2, C 
os[e + f*x]^2]*Sin[e + f*x])/(a*f*Sqrt[Sin[e + f*x]^2]))/(a*(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 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 (a \cos \left (f x +e \right )\right )^{m} \left (A +B \cos \left (f x +e \right )+C \cos \left (f x +e \right )^{2}\right )d x\]

Input:

int((a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x)
 

Output:

int((a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x)
 

Fricas [F]

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

integrate((a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x, algorithm="f 
ricas")
 

Output:

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

Sympy [F]

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

integrate((a*cos(f*x+e))**m*(A+B*cos(f*x+e)+C*cos(f*x+e)**2),x)
 

Output:

Integral((a*cos(e + f*x))**m*(A + B*cos(e + f*x) + C*cos(e + f*x)**2), x)
 

Maxima [F]

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

integrate((a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x, algorithm="m 
axima")
 

Output:

integrate((C*cos(f*x + e)^2 + B*cos(f*x + e) + A)*(a*cos(f*x + e))^m, x)
 

Giac [F]

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

integrate((a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x, algorithm="g 
iac")
 

Output:

integrate((C*cos(f*x + e)^2 + B*cos(f*x + e) + A)*(a*cos(f*x + e))^m, x)
 

Mupad [F(-1)]

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

int((a*cos(e + f*x))^m*(A + B*cos(e + f*x) + C*cos(e + f*x)^2),x)
 

Output:

int((a*cos(e + f*x))^m*(A + B*cos(e + f*x) + C*cos(e + f*x)^2), x)
 

Reduce [F]

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

int((a*cos(f*x+e))^m*(A+B*cos(f*x+e)+C*cos(f*x+e)^2),x)
 

Output:

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