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

Optimal result
Mathematica [B] (warning: unable to verify)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F(-1)]
Maxima [F]
Giac [F(-2)]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 33, antiderivative size = 286 \[ \int \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=\frac {a (A b-a B) c \operatorname {AppellF1}\left (\frac {1}{2},\frac {1-m}{2},1,\frac {3}{2},\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right ) (c \cos (e+f x))^{-1+m} \cos ^2(e+f x)^{\frac {1-m}{2}} \sin (e+f x)}{b \left (a^2-b^2\right ) f}-\frac {(A b-a B) \operatorname {AppellF1}\left (\frac {1}{2},-\frac {m}{2},1,\frac {3}{2},\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right ) (c \cos (e+f x))^m \cos ^2(e+f x)^{-m/2} \sin (e+f x)}{\left (a^2-b^2\right ) f}-\frac {B (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)}{b c f (1+m) \sqrt {\sin ^2(e+f x)}} \] Output:

a*(A*b-B*a)*c*AppellF1(1/2,1/2-1/2*m,1,3/2,sin(f*x+e)^2,-b^2*sin(f*x+e)^2/ 
(a^2-b^2))*(c*cos(f*x+e))^(-1+m)*(cos(f*x+e)^2)^(1/2-1/2*m)*sin(f*x+e)/b/( 
a^2-b^2)/f-(A*b-B*a)*AppellF1(1/2,-1/2*m,1,3/2,sin(f*x+e)^2,-b^2*sin(f*x+e 
)^2/(a^2-b^2))*(c*cos(f*x+e))^m*sin(f*x+e)/(a^2-b^2)/f/((cos(f*x+e)^2)^(1/ 
2*m))-B*(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)/b/c/f/(1+m)/(sin(f*x+e)^2)^(1/2)
 

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(10482\) vs. \(2(286)=572\).

Time = 35.00 (sec) , antiderivative size = 10482, normalized size of antiderivative = 36.65 \[ \int \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=\text {Result too large to show} \] Input:

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

Output:

Result too large to show
 

Rubi [A] (verified)

Time = 0.89 (sec) , antiderivative size = 281, normalized size of antiderivative = 0.98, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.242, Rules used = {3042, 3481, 3042, 3122, 3302, 3042, 3668, 333}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\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 )^m}{a+b \sin \left (e+f x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 3481

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3122

\(\displaystyle \frac {(A b-a B) \int \frac {\left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^m}{a+b \sin \left (e+f x+\frac {\pi }{2}\right )}dx}{b}-\frac {B \sin (e+f x) (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 )}{b c f (m+1) \sqrt {\sin ^2(e+f x)}}\)

\(\Big \downarrow \) 3302

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

\(\Big \downarrow \) 3042

\(\displaystyle \frac {(A b-a B) \left (a \int \frac {\left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^m}{a^2-b^2 \sin \left (e+f x+\frac {\pi }{2}\right )^2}dx-\frac {b \int \frac {\left (c \sin \left (e+f x+\frac {\pi }{2}\right )\right )^{m+1}}{a^2-b^2 \sin \left (e+f x+\frac {\pi }{2}\right )^2}dx}{c}\right )}{b}-\frac {B \sin (e+f x) (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 )}{b c f (m+1) \sqrt {\sin ^2(e+f x)}}\)

\(\Big \downarrow \) 3668

\(\displaystyle \frac {(A b-a B) \left (\frac {a c \cos ^2(e+f x)^{\frac {1-m}{2}} (c \cos (e+f x))^{m-1} \int \frac {\left (1-\sin ^2(e+f x)\right )^{\frac {m-1}{2}}}{a^2-b^2+b^2 \sin ^2(e+f x)}d\sin (e+f x)}{f}-\frac {b \cos ^2(e+f x)^{-m/2} (c \cos (e+f x))^m \int \frac {\left (1-\sin ^2(e+f x)\right )^{m/2}}{a^2-b^2+b^2 \sin ^2(e+f x)}d\sin (e+f x)}{f}\right )}{b}-\frac {B \sin (e+f x) (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 )}{b c f (m+1) \sqrt {\sin ^2(e+f x)}}\)

\(\Big \downarrow \) 333

\(\displaystyle \frac {(A b-a B) \left (\frac {a c \sin (e+f x) \cos ^2(e+f x)^{\frac {1-m}{2}} (c \cos (e+f x))^{m-1} \operatorname {AppellF1}\left (\frac {1}{2},\frac {1-m}{2},1,\frac {3}{2},\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )}-\frac {b \sin (e+f x) \cos ^2(e+f x)^{-m/2} (c \cos (e+f x))^m \operatorname {AppellF1}\left (\frac {1}{2},-\frac {m}{2},1,\frac {3}{2},\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )}\right )}{b}-\frac {B \sin (e+f x) (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 )}{b c f (m+1) \sqrt {\sin ^2(e+f x)}}\)

Input:

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

Output:

-((B*(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])/(b*c*f*(1 + m)*Sqrt[Sin[e + f*x]^2])) + ((A 
*b - a*B)*((a*c*AppellF1[1/2, (1 - m)/2, 1, 3/2, Sin[e + f*x]^2, -((b^2*Si 
n[e + f*x]^2)/(a^2 - b^2))]*(c*Cos[e + f*x])^(-1 + m)*(Cos[e + f*x]^2)^((1 
 - m)/2)*Sin[e + f*x])/((a^2 - b^2)*f) - (b*AppellF1[1/2, -1/2*m, 1, 3/2, 
Sin[e + f*x]^2, -((b^2*Sin[e + f*x]^2)/(a^2 - b^2))]*(c*Cos[e + f*x])^m*Si 
n[e + f*x])/((a^2 - b^2)*f*(Cos[e + f*x]^2)^(m/2))))/b
 

Defintions of rubi rules used

rule 333
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_), x_Symbol] :> Sim 
p[a^p*c^q*x*AppellF1[1/2, -p, -q, 3/2, (-b)*(x^2/a), (-d)*(x^2/c)], x] /; F 
reeQ[{a, b, c, d, p, q}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[p] || GtQ[a, 
0]) && (IntegerQ[q] || GtQ[c, 0])
 

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 3302
Int[((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*( 
x_)]), x_Symbol] :> Simp[a   Int[(d*Sin[e + f*x])^n/(a^2 - b^2*Sin[e + f*x] 
^2), x], x] - Simp[b/d   Int[(d*Sin[e + f*x])^(n + 1)/(a^2 - b^2*Sin[e + f* 
x]^2), x], x] /; FreeQ[{a, b, d, e, f, n}, x] && NeQ[a^2 - b^2, 0]
 

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

rule 3668
Int[((d_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeFactors[Cos[e + f*x], x]}, Simp[( 
-ff)*d^(2*IntPart[(m - 1)/2] + 1)*((d*Sin[e + f*x])^(2*FracPart[(m - 1)/2]) 
/(f*(Sin[e + f*x]^2)^FracPart[(m - 1)/2]))   Subst[Int[(1 - ff^2*x^2)^((m - 
 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, 
 d, e, f, m, p}, x] &&  !IntegerQ[m]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [F]

\[ \int \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=\int { \frac {{\left (B \cos \left (f x + e\right ) + A\right )} \left (c \cos \left (f x + e\right )\right )^{m}}{b \cos \left (f x + e\right ) + a} \,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*cos(f*x + e) + A)*(c*cos(f*x + e))^m/(b*cos(f*x + e) + a), x)
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F]

\[ \int \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=\int { \frac {{\left (B \cos \left (f x + e\right ) + A\right )} \left (c \cos \left (f x + e\right )\right )^{m}}{b \cos \left (f x + e\right ) + a} \,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)*(c*cos(f*x + e))^m/(b*cos(f*x + e) + a), x)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=\text {Exception raised: TypeError} \] Input:

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

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Unable to divide, perhaps due to ro 
unding error%%%{-1,[0,1,0,0]%%%} / %%%{1,[0,0,1,0]%%%}+%%%{-1,[0,0,0,1]%%% 
} Error:
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=\int \frac {{\left (c\,\cos \left (e+f\,x\right )\right )}^m\,\left (A+B\,\cos \left (e+f\,x\right )\right )}{a+b\,\cos \left (e+f\,x\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 \frac {(c \cos (e+f x))^m (A+B \cos (e+f x))}{a+b \cos (e+f x)} \, dx=c^{m} \left (\int \cos \left (f x +e \right )^{m}d x \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)