\(\int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx\) [445]

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

Optimal result

Integrand size = 23, antiderivative size = 215 \[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\frac {2 (2+n) (d \cos (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n}{2},\frac {2+n}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{3 a^2 f \sqrt {\sin ^2(e+f x)}}-\frac {(3+2 n) \cos (e+f x) (d \cos (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+n}{2},\frac {3+n}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{3 a^2 f \sqrt {\sin ^2(e+f x)}}-\frac {2 (2+n) (d \cos (e+f x))^n \tan (e+f x)}{3 a^2 f (1+\sec (e+f x))}-\frac {(d \cos (e+f x))^n \tan (e+f x)}{3 f (a+a \sec (e+f x))^2} \] Output:

2/3*(2+n)*(d*cos(f*x+e))^n*hypergeom([1/2, 1/2*n],[1+1/2*n],cos(f*x+e)^2)* 
sin(f*x+e)/a^2/f/(sin(f*x+e)^2)^(1/2)-1/3*(3+2*n)*cos(f*x+e)*(d*cos(f*x+e) 
)^n*hypergeom([1/2, 1/2+1/2*n],[3/2+1/2*n],cos(f*x+e)^2)*sin(f*x+e)/a^2/f/ 
(sin(f*x+e)^2)^(1/2)-2/3*(2+n)*(d*cos(f*x+e))^n*tan(f*x+e)/a^2/f/(1+sec(f* 
x+e))-1/3*(d*cos(f*x+e))^n*tan(f*x+e)/f/(a+a*sec(f*x+e))^2
 

Mathematica [A] (verified)

Time = 0.85 (sec) , antiderivative size = 223, normalized size of antiderivative = 1.04 \[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=-\frac {(d \cos (e+f x))^{3+n} \sin (e+f x)}{3 d^3 f (a+a \cos (e+f x))^2}-\frac {\left (d (2+n) (4+n) (3+2 n) (d \cos (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {3+n}{2},\frac {5+n}{2},\cos ^2(e+f x)\right )-2 (1+n) (3+n)^2 (d \cos (e+f x))^{4+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {4+n}{2},\frac {6+n}{2},\cos ^2(e+f x)\right )\right ) \sin (e+f x)}{3 a^2 d^4 f (3+n) (4+n) \sqrt {\sin ^2(e+f x)}}+\frac {2 (1+n) \cos ^3(e+f x) (d \cos (e+f x))^n \tan \left (\frac {1}{2} (e+f x)\right )}{3 a^2 f} \] Input:

Integrate[(d*Cos[e + f*x])^n/(a + a*Sec[e + f*x])^2,x]
 

Output:

-1/3*((d*Cos[e + f*x])^(3 + n)*Sin[e + f*x])/(d^3*f*(a + a*Cos[e + f*x])^2 
) - ((d*(2 + n)*(4 + n)*(3 + 2*n)*(d*Cos[e + f*x])^(3 + n)*Hypergeometric2 
F1[1/2, (3 + n)/2, (5 + n)/2, Cos[e + f*x]^2] - 2*(1 + n)*(3 + n)^2*(d*Cos 
[e + f*x])^(4 + n)*Hypergeometric2F1[1/2, (4 + n)/2, (6 + n)/2, Cos[e + f* 
x]^2])*Sin[e + f*x])/(3*a^2*d^4*f*(3 + n)*(4 + n)*Sqrt[Sin[e + f*x]^2]) + 
(2*(1 + n)*Cos[e + f*x]^3*(d*Cos[e + f*x])^n*Tan[(e + f*x)/2])/(3*a^2*f)
 

Rubi [A] (verified)

Time = 1.20 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.14, number of steps used = 13, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.565, Rules used = {3042, 4752, 3042, 4304, 25, 3042, 4508, 3042, 4274, 3042, 4259, 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 \frac {(d \cos (e+f x))^n}{(a \sec (e+f x)+a)^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (d \sin \left (e+f x+\frac {\pi }{2}\right )\right )^n}{\left (a \csc \left (e+f x+\frac {\pi }{2}\right )+a\right )^2}dx\)

\(\Big \downarrow \) 4752

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \int \frac {(d \sec (e+f x))^{-n}}{(\sec (e+f x) a+a)^2}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \int \frac {\left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{-n}}{\left (\csc \left (e+f x+\frac {\pi }{2}\right ) a+a\right )^2}dx\)

\(\Big \downarrow \) 4304

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (-\frac {\int -\frac {(d \sec (e+f x))^{-n} (a (n+3)-a (n+1) \sec (e+f x))}{\sec (e+f x) a+a}dx}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 25

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\int \frac {(d \sec (e+f x))^{-n} (a (n+3)-a (n+1) \sec (e+f x))}{\sec (e+f x) a+a}dx}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\int \frac {\left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{-n} \left (a (n+3)-a (n+1) \csc \left (e+f x+\frac {\pi }{2}\right )\right )}{\csc \left (e+f x+\frac {\pi }{2}\right ) a+a}dx}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 4508

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {\int (d \sec (e+f x))^{-n} \left (a^2 (n+1) (2 n+3)-2 a^2 n (n+2) \sec (e+f x)\right )dx}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {\int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{-n} \left (a^2 (n+1) (2 n+3)-2 a^2 n (n+2) \csc \left (e+f x+\frac {\pi }{2}\right )\right )dx}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 4274

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {a^2 (n+1) (2 n+3) \int (d \sec (e+f x))^{-n}dx-\frac {2 a^2 n (n+2) \int (d \sec (e+f x))^{1-n}dx}{d}}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {a^2 (n+1) (2 n+3) \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{-n}dx-\frac {2 a^2 n (n+2) \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{1-n}dx}{d}}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 4259

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {a^2 (n+1) (2 n+3) \left (\frac {\cos (e+f x)}{d}\right )^{-n} (d \sec (e+f x))^{-n} \int \left (\frac {\cos (e+f x)}{d}\right )^ndx-\frac {2 a^2 n (n+2) \left (\frac {\cos (e+f x)}{d}\right )^{-n} (d \sec (e+f x))^{-n} \int \left (\frac {\cos (e+f x)}{d}\right )^{n-1}dx}{d}}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {a^2 (n+1) (2 n+3) \left (\frac {\cos (e+f x)}{d}\right )^{-n} (d \sec (e+f x))^{-n} \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^ndx-\frac {2 a^2 n (n+2) \left (\frac {\cos (e+f x)}{d}\right )^{-n} (d \sec (e+f x))^{-n} \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^{n-1}dx}{d}}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle (d \cos (e+f x))^n (d \sec (e+f x))^n \left (\frac {\frac {\frac {2 a^2 (n+2) \sin (e+f x) (d \sec (e+f x))^{-n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n}{2},\frac {n+2}{2},\cos ^2(e+f x)\right )}{f \sqrt {\sin ^2(e+f x)}}-\frac {a^2 d (2 n+3) \sin (e+f x) (d \sec (e+f x))^{-n-1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n+1}{2},\frac {n+3}{2},\cos ^2(e+f x)\right )}{f \sqrt {\sin ^2(e+f x)}}}{a^2}-\frac {2 (n+2) \tan (e+f x) (d \sec (e+f x))^{-n}}{f (\sec (e+f x)+1)}}{3 a^2}-\frac {\tan (e+f x) (d \sec (e+f x))^{-n}}{3 f (a \sec (e+f x)+a)^2}\right )\)

Input:

Int[(d*Cos[e + f*x])^n/(a + a*Sec[e + f*x])^2,x]
 

Output:

(d*Cos[e + f*x])^n*(d*Sec[e + f*x])^n*(-1/3*Tan[e + f*x]/(f*(d*Sec[e + f*x 
])^n*(a + a*Sec[e + f*x])^2) + ((-((a^2*d*(3 + 2*n)*Hypergeometric2F1[1/2, 
 (1 + n)/2, (3 + n)/2, Cos[e + f*x]^2]*(d*Sec[e + f*x])^(-1 - n)*Sin[e + f 
*x])/(f*Sqrt[Sin[e + f*x]^2])) + (2*a^2*(2 + n)*Hypergeometric2F1[1/2, n/2 
, (2 + n)/2, Cos[e + f*x]^2]*Sin[e + f*x])/(f*(d*Sec[e + f*x])^n*Sqrt[Sin[ 
e + f*x]^2]))/a^2 - (2*(2 + n)*Tan[e + f*x])/(f*(d*Sec[e + f*x])^n*(1 + Se 
c[e + f*x])))/(3*a^2))
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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 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 4274
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_)), x_Symbol] :> Simp[a   Int[(d*Csc[e + f*x])^n, x], x] + Simp[b/d   In 
t[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]
 

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

rule 4508
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b 
- a*B))*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(b*f*(2*m + 
 1))), x] - Simp[1/(a^2*(2*m + 1))   Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Cs 
c[e + f*x])^n*Simp[b*B*n - a*A*(2*m + n + 1) + (A*b - a*B)*(m + n + 1)*Csc[ 
e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*b - a*B 
, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] &&  !GtQ[n, 0]
 

rule 4752
Int[(u_)*((c_.)*sin[(a_.) + (b_.)*(x_)])^(m_.), x_Symbol] :> Simp[(c*Csc[a 
+ b*x])^m*(c*Sin[a + b*x])^m   Int[ActivateTrig[u]/(c*Csc[a + b*x])^m, x], 
x] /; FreeQ[{a, b, c, m}, x] &&  !IntegerQ[m] && KnownSecantIntegrandQ[u, x 
]
 
Maple [F]

\[\int \frac {\left (d \cos \left (f x +e \right )\right )^{n}}{\left (a +a \sec \left (f x +e \right )\right )^{2}}d x\]

Input:

int((d*cos(f*x+e))^n/(a+a*sec(f*x+e))^2,x)
 

Output:

int((d*cos(f*x+e))^n/(a+a*sec(f*x+e))^2,x)
 

Fricas [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\int { \frac {\left (d \cos \left (f x + e\right )\right )^{n}}{{\left (a \sec \left (f x + e\right ) + a\right )}^{2}} \,d x } \] Input:

integrate((d*cos(f*x+e))^n/(a+a*sec(f*x+e))^2,x, algorithm="fricas")
 

Output:

integral((d*cos(f*x + e))^n/(a^2*sec(f*x + e)^2 + 2*a^2*sec(f*x + e) + a^2 
), x)
 

Sympy [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\frac {\int \frac {\left (d \cos {\left (e + f x \right )}\right )^{n}}{\sec ^{2}{\left (e + f x \right )} + 2 \sec {\left (e + f x \right )} + 1}\, dx}{a^{2}} \] Input:

integrate((d*cos(f*x+e))**n/(a+a*sec(f*x+e))**2,x)
 

Output:

Integral((d*cos(e + f*x))**n/(sec(e + f*x)**2 + 2*sec(e + f*x) + 1), x)/a* 
*2
 

Maxima [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\int { \frac {\left (d \cos \left (f x + e\right )\right )^{n}}{{\left (a \sec \left (f x + e\right ) + a\right )}^{2}} \,d x } \] Input:

integrate((d*cos(f*x+e))^n/(a+a*sec(f*x+e))^2,x, algorithm="maxima")
 

Output:

integrate((d*cos(f*x + e))^n/(a*sec(f*x + e) + a)^2, x)
                                                                                    
                                                                                    
 

Giac [F(-2)]

Exception generated. \[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\text {Exception raised: TypeError} \] Input:

integrate((d*cos(f*x+e))^n/(a+a*sec(f*x+e))^2,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,2,0]%%%}+%%%{-3,[0,1,0,0]%%%} / %%%{4,[0,0,0,2]%%%} 
 Error: B
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\int \frac {{\left (d\,\cos \left (e+f\,x\right )\right )}^n}{{\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^2} \,d x \] Input:

int((d*cos(e + f*x))^n/(a + a/cos(e + f*x))^2,x)
 

Output:

int((d*cos(e + f*x))^n/(a + a/cos(e + f*x))^2, x)
 

Reduce [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+a \sec (e+f x))^2} \, dx=\frac {d^{n} \left (\int \frac {\cos \left (f x +e \right )^{n}}{\sec \left (f x +e \right )^{2}+2 \sec \left (f x +e \right )+1}d x \right )}{a^{2}} \] Input:

int((d*cos(f*x+e))^n/(a+a*sec(f*x+e))^2,x)
 

Output:

(d**n*int(cos(e + f*x)**n/(sec(e + f*x)**2 + 2*sec(e + f*x) + 1),x))/a**2