\(\int (a+b \sec (e+f x))^2 (d \tan (e+f x))^n \, dx\) [342]

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 = 23, antiderivative size = 160 \[ \int (a+b \sec (e+f x))^2 (d \tan (e+f x))^n \, dx=\frac {b^2 (d \tan (e+f x))^{1+n}}{d f (1+n)}+\frac {a^2 \operatorname {Hypergeometric2F1}\left (1,\frac {1+n}{2},\frac {3+n}{2},-\tan ^2(e+f x)\right ) (d \tan (e+f x))^{1+n}}{d f (1+n)}+\frac {2 a b \cos ^2(e+f x)^{\frac {2+n}{2}} \operatorname {Hypergeometric2F1}\left (\frac {1+n}{2},\frac {2+n}{2},\frac {3+n}{2},\sin ^2(e+f x)\right ) \sec (e+f x) (d \tan (e+f x))^{1+n}}{d f (1+n)} \] Output:

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

Mathematica [A] (verified)

Time = 0.87 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.11 \[ \int (a+b \sec (e+f x))^2 (d \tan (e+f x))^n \, dx=\frac {d (d \tan (e+f x))^{-1+n} \left (-\tan ^2(e+f x)\right )^{-n/2} \left (2 a b (1+n) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1-n}{2},\frac {3}{2},\sec ^2(e+f x)\right ) \sec (e+f x) \sqrt {-\tan ^2(e+f x)}-a^2 \operatorname {Hypergeometric2F1}\left (1,\frac {1+n}{2},\frac {3+n}{2},-\tan ^2(e+f x)\right ) \left (-\tan ^2(e+f x)\right )^{\frac {2+n}{2}}+b^2 \left (\sqrt {-\tan ^2(e+f x)}-\left (-\tan ^2(e+f x)\right )^{\frac {2+n}{2}}\right )\right )}{f (1+n)} \] Input:

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

Output:

(d*(d*Tan[e + f*x])^(-1 + n)*(2*a*b*(1 + n)*Hypergeometric2F1[1/2, (1 - n) 
/2, 3/2, Sec[e + f*x]^2]*Sec[e + f*x]*Sqrt[-Tan[e + f*x]^2] - a^2*Hypergeo 
metric2F1[1, (1 + n)/2, (3 + n)/2, -Tan[e + f*x]^2]*(-Tan[e + f*x]^2)^((2 
+ n)/2) + b^2*(Sqrt[-Tan[e + f*x]^2] - (-Tan[e + f*x]^2)^((2 + n)/2))))/(f 
*(1 + n)*(-Tan[e + f*x]^2)^(n/2))
 

Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3042, 4374, 2009}

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 \sec (e+f x))^2 (d \tan (e+f x))^n \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (a+b \csc \left (e+f x+\frac {\pi }{2}\right )\right )^2 \left (-d \cot \left (e+f x+\frac {\pi }{2}\right )\right )^ndx\)

\(\Big \downarrow \) 4374

\(\displaystyle \int \left (a^2 (d \tan (e+f x))^n+2 a b \sec (e+f x) (d \tan (e+f x))^n+b^2 \sec ^2(e+f x) (d \tan (e+f x))^n\right )dx\)

\(\Big \downarrow \) 2009

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 4374
Int[(cot[(c_.) + (d_.)*(x_)]*(e_.))^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + ( 
a_))^(n_), x_Symbol] :> Int[ExpandIntegrand[(e*Cot[c + d*x])^m, (a + b*Csc[ 
c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && IGtQ[n, 0]
 
Maple [F]

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

Input:

int((a+b*sec(f*x+e))^2*(d*tan(f*x+e))^n,x)
 

Output:

int((a+b*sec(f*x+e))^2*(d*tan(f*x+e))^n,x)
 

Fricas [F]

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

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

Output:

integral((b^2*sec(f*x + e)^2 + 2*a*b*sec(f*x + e) + a^2)*(d*tan(f*x + e))^ 
n, x)
 

Sympy [F]

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

integrate((a+b*sec(f*x+e))**2*(d*tan(f*x+e))**n,x)
 

Output:

Integral((d*tan(e + f*x))**n*(a + b*sec(e + f*x))**2, x)
 

Maxima [F]

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

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

Output:

integrate((b*sec(f*x + e) + a)^2*(d*tan(f*x + e))^n, x)
 

Giac [F]

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

integrate((a+b*sec(f*x+e))^2*(d*tan(f*x+e))^n,x, algorithm="giac")
 

Output:

integrate((b*sec(f*x + e) + a)^2*(d*tan(f*x + e))^n, x)
 

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

int((a+b*sec(f*x+e))^2*(d*tan(f*x+e))^n,x)
 

Output:

d**n*(int(tan(e + f*x)**n,x)*a**2 + int(tan(e + f*x)**n*sec(e + f*x)**2,x) 
*b**2 + 2*int(tan(e + f*x)**n*sec(e + f*x),x)*a*b)