Rules for integrands of the form ((Trig[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)

1.  ∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx

1.  ∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0

1:  ∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ p∈ℤ, then

∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  (1/((4^p)(c^p)))∫(((b+2c ((Sec[d+e x])^n)))^(2p))dx

Program code:

Int[(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[(b+2*c*Sec[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

Int[(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[(b+2*c*Csc[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

2:  ∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^p)/(((b+2 c F[x]))^(2p)))==0

Rule: If  (b^2)-4a c==0 ∧ p∉ℤ, then

∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  ((((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)/(((b+2 c ((Sec[d+e x])^n)))^(2p)))∫(((b+2c ((Sec[d+e x])^n)))^(2p))dx

Program code:

Int[(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Sec[d+e*x]^n+c*Sec[d+e*x]^(2*n))^p/(b+2*c*Sec[d+e*x]^n)^(2*p)*Int[u*(b+2*c*Sec[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

Int[(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Csc[d+e*x]^n+c*Csc[d+e*x]^(2*n))^p/(b+2*c*Csc[d+e*x]^n)^(2*p)*Int[u*(b+2*c*Csc[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

2.  ∫(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c≠0

1:  ∫(1/(a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))dx  when  (b^2)-4 a c≠0

Derivation: Algebraic expansion

Basis: If  q=(Sqrt[(b^2)-4 a c]), then (1/(a+b z+c (z^2)))==((2 c)/(q(b-q+2 c z)))-((2 c)/(q(b+q+2 c z)))

Rule: If  (b^2)-4 a c≠0, let  q=(Sqrt[(b^2)-4 a c]), then

∫(1/(a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))dx  ⟶  ((2 c)/q)∫(1/(b-q+2 c ((Sec[d+e x])^n)))dx-((2 c)/q)∫(1/(b+q+2 c ((Sec[d+e x])^n)))dx

Program code:

Int[1/(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  2*c/q*Int[1/(b-q+2*c*Sec[d+e*x]^n),x] - 
  2*c/q*Int[1/(b+q+2*c*Sec[d+e*x]^n),x]] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0]

Int[1/(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_.),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  2*c/q*Int[1/(b-q+2*c*Csc[d+e*x]^n),x] - 
  2*c/q*Int[1/(b+q+2*c*Csc[d+e*x]^n),x]] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0]

2.  ∫((Sin[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx

1:  ∫((Sin[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when ((m-1)/2)∈ℤ ∧ n∈ℤ ∧ p∈ℤ

Derivation: Integration by substitution

Basis: If ((m-1)/2)∈ℤ, then ((Sin[d+e x])^m)F[Sec[d+e x]]==-(1/e)Subst[(((1-(x^2)))^((m-1)/2))F[(1/x)],x,Cos[d+e x]] (∂_x)Cos[d+e x]

Rule: If ((m-1)/2)∈ℤ ∧ n∈ℤ ∧ p∈ℤ, then

∫((Sin[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  -(1/e)Subst[∫(((((1-(x^2)))^((m-1)/2))(((c+b (x^n)+a (x^(2n))))^p))/(x^(2n p)))dx,x,Cos[d+e x]]

Program code:

Int[sin[d_.+e_.*x_]^m_.*(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Cos[d+e*x],x]},
  -f/e*Subst[Int[(1-f^2*x^2)^((m-1)/2)*(b+a*(f*x)^n)^p/(f*x)^(n*p),x],x,Cos[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegersQ[n,p]

Int[cos[d_.+e_.*x_]^m_.*(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Sin[d+e*x],x]},
  f/e*Subst[Int[(1-f^2*x^2)^((m-1)/2)*(b+a*(f*x)^n)^p/(f*x)^(n*p),x],x,Sin[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegersQ[n,p]

2:  ∫((Sin[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (m/2)∈ℤ ∧ (n/2)∈ℤ

Derivation: Integration by substitution

Basis: ((Sin[z])^2)==(((Tan[z])^2)/(1+((Tan[z])^2)))

Basis: ((Sec[z])^2)==1+((Tan[z])^2)

Basis: If (m/2)∈ℤ, then ((Sin[d+e x])^m)F[((Sec[d+e x])^2)]==(1/e)Subst[(((x^m)F[1+(x^2)])/(((1+(x^2)))^(m/2+1))),x,Tan[d+e x]](∂_x)Tan[d+e x]

Rule: If (m/2)∈ℤ ∧ (n/2)∈ℤ, then

∫((Sin[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  (1/e)Subst[∫(((x^m)(((a+b (((1+(x^2)))^(n/2))+c (((1+(x^2)))^n)))^p))/(((1+(x^2)))^(m/2+1)))dx,x,Tan[d+e x]]

Program code:

Int[sin[d_.+e_.*x_]^m_*(a_.+b_.*sec[d_.+e_.*x_]^n_+c_.*sec[d_.+e_.*x_]^n2_)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Tan[d+e*x],x]},
  f^(m+1)/e*Subst[Int[x^m*ExpandToSum[a+b*(1+f^2*x^2)^(n/2)+c*(1+f^2*x^2)^n,x]^p/(1+f^2*x^2)^(m/2+1),x],x,Tan[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e,p},x] && EqQ[n2,2*n] && IntegerQ[m/2] && IntegerQ[n/2]

Int[cos[d_.+e_.*x_]^m_*(a_.+b_.*csc[d_.+e_.*x_]^n_+c_.*csc[d_.+e_.*x_]^n2_)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Cot[d+e*x],x]},
  -f^(m+1)/e*Subst[Int[x^m*ExpandToSum[a+b*(1+f^2*x^2)^(n/2)+c*(1+f^2*x^2)^n,x]^p/(1+f^2*x^2)^(m/2+1),x],x,Cot[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e,p},x] && EqQ[n2,2*n] && IntegerQ[m/2] && IntegerQ[n/2]

3.  ∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx

1.  ∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0

1:  ∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ p∈ℤ, then

∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  (1/((4^p)(c^p)))∫((Sec[d+e x])^m)(((b+2c ((Sec[d+e x])^n)))^(2p))dx

Program code:

Int[sec[d_.+e_.*x_]^m_.*(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  1/(4^p*c^p)*Int[Sec[d+e*x]^m*(b+2*c*Sec[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

Int[csc[d_.+e_.*x_]^m_.*(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  1/(4^p*c^p)*Int[Csc[d+e*x]^m*(b+2*c*Csc[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

2:  ∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^p)/(((b+2 c F[x]))^(2p)))==0

Rule: If  (b^2)-4a c==0 ∧ p∉ℤ, then

∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  ((((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)/(((b+2 c ((Sec[d+e x])^n)))^(2p)))∫((Sec[d+e x])^m)(((b+2c ((Sec[d+e x])^n)))^(2p))dx

Program code:

Int[sec[d_.+e_.*x_]^m_.*(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Sec[d+e*x]^n+c*Sec[d+e*x]^(2*n))^p/(b+2*c*Sec[d+e*x]^n)^(2*p)*Int[Sec[d+e*x]^m*(b+2*c*Sec[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

Int[csc[d_.+e_.*x_]^m_.*(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Csc[d+e*x]^n+c*Csc[d+e*x]^(2*n))^p/(b+2*c*Csc[d+e*x]^n)^(2*p)*Int[Csc[d+e*x]^m*(b+2*c*Csc[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

2.  ∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (b^2)-4a c≠0

1:  ∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (m|n|p)∈ℤ

Derivation: Algebraic expansion

Rule: If  (m|n|p)∈ℤ, then

∫((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  ∫ExpandTrig[((Sec[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p),x]dx

Proeram code:

Int[sec[d_.+e_.*x_]^m_.*(a_.+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  Int[ExpandTrig[sec[d+e*x]^m*(a+b*sec[d+e*x]^n+c*sec[d+e*x]^(2*n))^p,x],x] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegersQ[m,n,p]

Int[csc[d_.+e_.*x_]^m_.*(a_.+b_.*csc[d_.+e_.*x_]^n_.+c_.*csc[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  Int[ExpandTrig[csc[d+e*x]^m*(a+b*csc[d+e*x]^n+c*csc[d+e*x]^(2*n))^p,x],x] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegersQ[m,n,p]

4.  ∫((Tan[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx

1:  ∫((Tan[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∈ℤ ∧ n∈ℤ ∧ p∈ℤ

Derivation: Integration by substitution

Basis: ((Tan[z])^2)==((1-((Cos[z])^2))/((Cos[z])^2))

Basis: If ((m-1)/2)∈ℤ, then ((Tan[d+e x])^m)F[Sec[d+e x]]==-(1/e)Subst[(((((1-(x^2)))^((m-1)/2))F[(1/x)])/(x^m)),x,Cos[d+e x]](∂_x)Cos[d+e x]

Rule: If ((m-1)/2)∈ℤ ∧ n∈ℤ ∧ p∈ℤ, then

∫((Tan[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  -(1/e)Subst[∫(((((1-(x^2)))^((m-1)/2))(((c+b (x^n)+a (x^(2n))))^p))/(x^(m+2n p))) dx,x,Cos[d+e x]]

Program code:

Int[tan[d_.+e_.*x_]^m_.*(a_+b_.*sec[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Cos[d+e*x],x]},
  -1/(e*f^(m+n*p-1))*Subst[Int[(1-f^2*x^2)^((m-1)/2)*(c+b*(f*x)^n+c*(f*x)^(2*n))^p/x^(m+2*n*p),x],x,Cos[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegerQ[n] && IntegerQ[p]

Int[cot[d_.+e_.*x_]^m_.*(a_+b_.*csc[d_.+e_.*x_]^n_.+c_.*sec[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Sin[d+e*x],x]},
  1/(e*f^(m+n*p-1))*Subst[Int[(1-f^2*x^2)^((m-1)/2)*(c+b*(f*x)^n+c*(f*x)^(2*n))^p/x^(m+2*n*p),x],x,Sin[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegerQ[n] && IntegerQ[p]

2:  ∫((Tan[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  when  (m/2)∈ℤ ∧ (n/2)∈ℤ

Derivation: Integration by substitution

Basis: ((Sec[z])^2)==1+((Tan[z])^2)

Basis: ((Tan[d+e x])^m)F[((Sec[d+e x])^2)]==(1/e)Subst[(((x^m)F[1+(x^2)])/(1+(x^2))),x,Tan[d+e x]](∂_x)Tan[d+e x]

Rule: If  (m/2)∈ℤ ∧ (n/2)∈ℤ, then

∫((Tan[d+e x])^m)(((a+b ((Sec[d+e x])^n)+c ((Sec[d+e x])^(2n))))^p)dx  ⟶  (1/e)Subst[∫(((x^m)(((a+b (((1+(x^2)))^(n/2))+c (((1+(x^2)))^n)))^p))/(1+(x^2)))dx,x,Tan[d+e x]]

Program code:

Int[tan[d_.+e_.*x_]^m_.*(a_+b_.*sec[d_.+e_.*x_]^n_+c_.*sec[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Tan[d+e*x],x]},
  f^(m+1)/e*Subst[Int[x^m*ExpandToSum[a+b*(1+f^2*x^2)^(n/2)+c*(1+f^2*x^2)^n,x]^p/(1+f^2*x^2),x],x,Tan[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[m/2] && IntegerQ[n/2]

Int[cot[d_.+e_.*x_]^m_.*(a_+b_.*csc[d_.+e_.*x_]^n_+c_.*sec[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{f=FreeFactors[Cot[d+e*x],x]},
  -f^(m+1)/e*Subst[Int[x^m*ExpandToSum[a+b*(1+f^2*x^2)^(n/2)+c*(1+f^2*x^2)^n,x]^p/(1+f^2*x^2),x],x,Cot[d+e*x]/f]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[m/2] && IntegerQ[n/2]

5.  ∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx

1.  ∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  when  (b^2)-4a c==0

1:  ∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  when  (b^2)-4a c==0 ∧ n∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ n∈ℤ, then

∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  ⟶  (1/((4^n)(c^n)))∫(A+B Sec[d+e x])(((b+2c Sec[d+e x]))^(2n))dx

Program code:

Int[(A_+B_.*sec[d_.+e_.*x_])*(a_+b_.*sec[d_.+e_.*x_]+c_.*sec[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  1/(4^n*c^n)*Int[(A+B*Sec[d+e*x])*(b+2*c*Sec[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && IntegerQ[n]

Int[(A_+B_.*csc[d_.+e_.*x_])*(a_+b_.*csc[d_.+e_.*x_]+c_.*csc[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  1/(4^n*c^n)*Int[(A+B*Csc[d+e*x])*(b+2*c*Csc[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && IntegerQ[n]

2:  ∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  when  (b^2)-4a c==0 ∧ n∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^n)/(((b+2 c F[x]))^(2n)))==0

Rule: If  (b^2)-4a c==0 ∧ n∉ℤ, then

∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  ⟶  ((((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)/(((b+2 c Sec[d+e x]))^(2n)))∫(A+B Sec[d+e x])(((b+2c Sec[d+e x]))^(2n))dx

Program code:

Int[(A_+B_.*sec[d_.+e_.*x_])*(a_+b_.*sec[d_.+e_.*x_]+c_.*sec[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  (a+b*Sec[d+e*x]+c*Sec[d+e*x]^2)^n/(b+2*c*Sec[d+e*x])^(2*n)*Int[(A+B*Sec[d+e*x])*(b+2*c*Sec[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[n]]

Int[(A_+B_.*csc[d_.+e_.*x_])*(a_+b_.*csc[d_.+e_.*x_]+c_.*csc[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  (a+b*Csc[d+e*x]+c*Csc[d+e*x]^2)^n/(b+2*c*Csc[d+e*x])^(2*n)*Int[(A+B*Csc[d+e*x])*(b+2*c*Csc[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[n]]

2.  ∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  when  (b^2)-4a c≠0

1:  ∫((A+B Sec[d+e x])/(a+b Sec[d+e x]+c ((Sec[d+e x])^2)))dx  when  (b^2)-4 a c≠0

Derivation: Algebraic expansion

Basis: If  q=(Sqrt[(b^2)-4 a c]), then ((A+B z)/(a+b z+c (z^2)))==(B+((b B-2 A c)/q))(1/(b+q+2 c z))+(B-((b B-2 A c)/q))(1/(b-q+2 c z))

Rule: If  (b^2)-4 a c≠0, let  q=(Sqrt[(b^2)-4 a c]), then

∫((A+B Sec[d+e x])/(a+b Sec[d+e x]+c ((Sec[d+e x])^2)))dx  ⟶  (B+((b B-2 A c)/q))∫(1/(b+q+2 c Sec[d+e x]))dx+(B-((b B-2 A c)/q))∫(1/(b-q+2 c Sec[d+e x]))dx

Program code:

Int[(A_+B_.*sec[d_.+e_.*x_])/(a_.+b_.*sec[d_.+e_.*x_]+c_.*sec[d_.+e_.*x_]^2),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  (B+(b*B-2*A*c)/q)*Int[1/(b+q+2*c*Sec[d+e*x]),x] + 
  (B-(b*B-2*A*c)/q)*Int[1/(b-q+2*c*Sec[d+e*x]),x]] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0]

Int[(A_+B_.*csc[d_.+e_.*x_])/(a_.+b_.*csc[d_.+e_.*x_]+c_.*csc[d_.+e_.*x_]^2),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  (B+(b*B-2*A*c)/q)*Int[1/(b+q+2*c*Csc[d+e*x]),x] + 
  (B-(b*B-2*A*c)/q)*Int[1/(b-q+2*c*Csc[d+e*x]),x]] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0]

2:  ∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  when  (b^2)-4 a c≠0 ∧ n∈ℤ

Derivation: Algebraic expansion

Rule: If  (b^2)-4 a c≠0 ∧ n∈ℤ

∫(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n)dx  ⟶  ∫ExpandTrig[(A+B Sec[d+e x])(((a+b Sec[d+e x]+c ((Sec[d+e x])^2)))^n),x]dx

Program code:

Int[(A_+B_.*sec[d_.+e_.*x_])*(a_.+b_.*sec[d_.+e_.*x_]+c_.*sec[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  Int[ExpandTrig[(A+B*sec[d+e*x])*(a+b*sec[d+e*x]+c*sec[d+e*x]^2)^n,x],x] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0] && IntegerQ[n]

Int[(A_+B_.*csc[d_.+e_.*x_])*(a_.+b_.*csc[d_.+e_.*x_]+c_.*csc[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  Int[ExpandTrig[(A+B*csc[d+e*x])*(a+b*csc[d+e*x]+c*csc[d+e*x]^2)^n,x],x] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0] && IntegerQ[n]