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

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

Optimal result

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

-(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))*cos(f*x+e)*(cos(f*x+e)^2)^(1/2*m)*(c*sec(f*x+e))^(1+m)*sin(f*x+e)/(a^2 
-b^2)/c/f+a*(A*b-B*a)*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))*(cos(f*x+e)^2)^(1/2+1/2*m)*(c*sec(f*x+e))^(1+m)*sin(f*x 
+e)/b/(a^2-b^2)/c/f-B*c*hypergeom([1/2, 1/2-1/2*m],[3/2-1/2*m],cos(f*x+e)^ 
2)*(c*sec(f*x+e))^(-1+m)*sin(f*x+e)/b/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. \(10630\) vs. \(2(299)=598\).

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

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

Output:

Result too large to show
 

Rubi [A] (verified)

Time = 1.40 (sec) , antiderivative size = 305, normalized size of antiderivative = 1.02, number of steps used = 15, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.424, Rules used = {3042, 3439, 3042, 4526, 3042, 4259, 3042, 3122, 4356, 3042, 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 \sec (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 \csc \left (e+f x+\frac {\pi }{2}\right )\right )^m}{a+b \sin \left (e+f x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 3439

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4526

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4259

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3122

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

\(\Big \downarrow \) 4356

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3302

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3668

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

\(\Big \downarrow \) 333

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

Input:

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

Output:

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

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 3439
Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*((a_.) + (b_.)*sin[(e_.) + (f_.)* 
(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Sim 
p[g^(m + n)   Int[(g*Csc[e + f*x])^(p - m - n)*(b + a*Csc[e + f*x])^m*(d + 
c*Csc[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && NeQ[b*c 
- a*d, 0] &&  !IntegerQ[p] && IntegerQ[m] && IntegerQ[n]
 

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]
 

rule 4259
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] 
)^(n - 1)*((Sin[c + d*x]/b)^(n - 1)   Int[1/(Sin[c + d*x]/b)^n, x]), x] /; 
FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]
 

rule 4356
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^(m_.), x_Symbol] :> Simp[Sin[e + f*x]^n*(d*Csc[e + f*x])^n   Int[(b + 
 a*Sin[e + f*x])^m/Sin[e + f*x]^(m + n), x], x] /; FreeQ[{a, b, d, e, f, n} 
, x] && NeQ[a^2 - b^2, 0] && IntegerQ[m]
 

rule 4526
Int[((csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + 
(A_)))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[A/a   Int[ 
(d*Csc[e + f*x])^n, x], x] - Simp[(A*b - a*B)/(a*d)   Int[(d*Csc[e + f*x])^ 
(n + 1)/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] 
&& NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F(-2)]

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

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

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

Output:

c**m*int(sec(e + f*x)**m,x)