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

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 = 21, antiderivative size = 129 \[ \int (a+b \sec (e+f x)) (d \tan (e+f x))^n \, dx=\frac {a \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 {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:

a*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)+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.53 (sec) , antiderivative size = 106, normalized size of antiderivative = 0.82 \[ \int (a+b \sec (e+f x)) (d \tan (e+f x))^n \, dx=\frac {(d \tan (e+f x))^n \left (\frac {a \operatorname {Hypergeometric2F1}\left (1,\frac {1+n}{2},\frac {3+n}{2},-\tan ^2(e+f x)\right ) \tan (e+f x)}{1+n}+b \csc (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1-n}{2},\frac {3}{2},\sec ^2(e+f x)\right ) \left (-\tan ^2(e+f x)\right )^{\frac {1-n}{2}}\right )}{f} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.39 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 4372, 3042, 3097, 3957, 278}

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)) (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 ) \left (-d \cot \left (e+f x+\frac {\pi }{2}\right )\right )^ndx\)

\(\Big \downarrow \) 4372

\(\displaystyle a \int (d \tan (e+f x))^ndx+b \int \sec (e+f x) (d \tan (e+f x))^ndx\)

\(\Big \downarrow \) 3042

\(\displaystyle a \int (d \tan (e+f x))^ndx+b \int \sec (e+f x) (d \tan (e+f x))^ndx\)

\(\Big \downarrow \) 3097

\(\displaystyle a \int (d \tan (e+f x))^ndx+\frac {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)}\)

\(\Big \downarrow \) 3957

\(\displaystyle \frac {a d \int \frac {(d \tan (e+f x))^n}{\tan ^2(e+f x) d^2+d^2}d(d \tan (e+f x))}{f}+\frac {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)}\)

\(\Big \downarrow \) 278

\(\displaystyle \frac {a (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 {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)}\)

Input:

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

Output:

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

Defintions of rubi rules used

rule 278
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( 
c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( 
-b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] &&  !IGtQ[p, 0] && (ILtQ[p, 0 
] || GtQ[a, 0])
 

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

rule 3097
Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^( 
n_), x_Symbol] :> Simp[(a*Sec[e + f*x])^m*(b*Tan[e + f*x])^(n + 1)*((Cos[e 
+ f*x]^2)^((m + n + 1)/2)/(b*f*(n + 1)))*Hypergeometric2F1[(n + 1)/2, (m + 
n + 1)/2, (n + 3)/2, Sin[e + f*x]^2], x] /; FreeQ[{a, b, e, f, m, n}, x] && 
  !IntegerQ[(n - 1)/2] &&  !IntegerQ[m/2]
 

rule 3957
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d   Subst[Int 
[x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && 
!IntegerQ[n]
 

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

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

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F]

\[ \int (a+b \sec (e+f x)) (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 )\, dx \] Input:

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

Timed out. \[ \int (a+b \sec (e+f x)) (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 ) \,d x \] Input:

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

Output:

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

Reduce [F]

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

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

Output:

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