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

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

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

1:  ∫(((a+b ((Sin[d+e x])^n)+c ((Sin[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 ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  ⟶  (1/((4^p)(c^p)))∫(((b+2c ((Sin[d+e x])^n)))^(2p))dx

Program code:

Int[(a_.+b_.*sin[d_.+e_.*x_]^n_.+c_.*sin[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[(b+2*c*Sin[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_.*cos[d_.+e_.*x_]^n_.+c_.*cos[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[(b+2*c*Cos[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 ((Sin[d+e x])^n)+c ((Sin[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 ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  ⟶  ((((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)/(((b+2 c ((Sin[d+e x])^n)))^(2p)))∫(((b+2c ((Sin[d+e x])^n)))^(2p))dx

Program code:

Int[(a_.+b_.*sin[d_.+e_.*x_]^n_.+c_.*sin[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Sin[d+e*x]^n+c*Sin[d+e*x]^(2*n))^p/(b+2*c*Sin[d+e*x]^n)^(2*p)*Int[u*(b+2*c*Sin[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_.*cos[d_.+e_.*x_]^n_.+c_.*cos[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Cos[d+e*x]^n+c*Cos[d+e*x]^(2*n))^p/(b+2*c*Cos[d+e*x]^n)^(2*p)*Int[u*(b+2*c*Cos[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 ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  (b^2)-4a c≠0

1:  ∫(1/(a+b ((Sin[d+e x])^n)+c ((Sin[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 ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))dx  ⟶  ((2 c)/q)∫(1/(b-q+2 c ((Sin[d+e x])^n)))dx-((2 c)/q)∫(1/(b+q+2 c ((Sin[d+e x])^n)))dx

Program code:

Int[1/(a_.+b_.*sin[d_.+e_.*x_]^n_.+c_.*sin[d_.+e_.*x_]^n2_.),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  2*c/q*Int[1/(b-q+2*c*Sin[d+e*x]^n),x] - 
  2*c/q*Int[1/(b+q+2*c*Sin[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_.*cos[d_.+e_.*x_]^n_.+c_.*cos[d_.+e_.*x_]^n2_.),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  2*c/q*Int[1/(b-q+2*c*Cos[d+e*x]^n),x] - 
  2*c/q*Int[1/(b+q+2*c*Cos[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 ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx

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

1:  ∫((Sin[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[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

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

Program code:

Int[sin[d_.+e_.*x_]^m_.*(a_.+b_.*sin[d_.+e_.*x_]^n_.+c_.*sin[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  1/(4^p*c^p)*Int[Sin[d+e*x]^m*(b+2*c*Sin[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[cos[d_.+e_.*x_]^m_.*(a_.+b_.*cos[d_.+e_.*x_]^n_.+c_.*cos[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  1/(4^p*c^p)*Int[Cos[d+e*x]^m*(b+2*c*Cos[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:  ∫((Sin[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[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

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

Program code:

Int[sin[d_.+e_.*x_]^m_.*(a_.+b_.*sin[d_.+e_.*x_]^n_.+c_.*sin[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Sin[d+e*x]^n+c*Sin[d+e*x]^(2*n))^p/(b+2*c*Sin[d+e*x]^n)^(2*p)*Int[Sin[d+e*x]^m*(b+2*c*Sin[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[cos[d_.+e_.*x_]^m_.*(a_.+b_.*cos[d_.+e_.*x_]^n_.+c_.*cos[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Cos[d+e*x]^n+c*Cos[d+e*x]^(2*n))^p/(b+2*c*Cos[d+e*x]^n)^(2*p)*Int[Cos[d+e*x]^m*(b+2*c*Cos[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.  ∫((Sin[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  (b^2)-4a c≠0

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

Derivation: Integration by substitution

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

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

Rule: If  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n/2)∈ℤ ∧ p∈ℤ, then

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

Program code:

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

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

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

Derivation: Algebraic expansion

Rule: If  (b^2)-4a c≠0 ∧ (m|n|p)∈ℤ, then

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

Proeram code:

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

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

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

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

Derivation: Integration by substitution

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

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

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

Program code:

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

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

2.  ∫((Cos[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when ((m-1)/2)∉ℤ

1.  ∫((Cos[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0

1:  ∫((Cos[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (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  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0 ∧ p∈ℤ, then

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

Program code:

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

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

2:  ∫((Cos[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (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  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0 ∧ p∉ℤ, then

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

Program code:

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

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

2.  ∫((Cos[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (b^2)-4a c≠0

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

Derivation: Integration by substitution

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

Basis: ((Cos[z])^2)==(((Cot[z])^2)/(1+((Cot[z])^2)))

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

Rule: If  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n/2)∈ℤ ∧ p∈ℤ, then

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

Program code:

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

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

2:  ∫((Cos[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n|p)∈ℤ

Derivation: Algebraic expansion

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

Rule: If  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n|p)∈ℤ, then

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

Proeram code:

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

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

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

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

Derivation: Integration by substitution

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

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

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

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

Program code:

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

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

2.  ∫((Tan[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when ((m-1)/2)∉ℤ

1.  ∫((Tan[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0

1:  ∫((Tan[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (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  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0 ∧ p∈ℤ, then

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

Program code:

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

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

2:  ∫((Tan[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (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  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0 ∧ p∉ℤ, then

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

Program code:

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

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

2.  ∫((Tan[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (b^2)-4a c≠0

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

Derivation: Integration by substitution

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

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

Rule: If  ((m-1)/2)∉ℤ ∧ (b^2)-4a c≠0 ∧ (n/2)∈ℤ ∧ p∈ℤ, then

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

Program code:

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

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

2:  ∫((Tan[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n|p)∈ℤ

Derivation: Algebraic expansion

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

Rule: If  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n|p)∈ℤ, then

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

Proeram code:

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

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

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

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

Derivation: Integration by substitution

Basis: ((Cot[z])^2)==((1-((Sin[z])^2))/((Sin[z])^2))

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

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

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

Program code:

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

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

2.  ∫((Cot[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when ((m-1)/2)∉ℤ

1.  ∫((Cot[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0

1:  ∫((Cot[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (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  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0 ∧ p∈ℤ, then

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

Program code:

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

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

2:  ∫((Cot[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (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  ((m-1)/2)∉ℤ ∧ (b^2)-4a c==0 ∧ p∉ℤ, then

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

Program code:

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

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

2.  ∫((Cot[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  ((m-1)/2)∉ℤ ∧ (b^2)-4a c≠0

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

Derivation: Integration by substitution

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

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

Rule: If  ((m-1)/2)∉ℤ ∧ (b^2)-4a c≠0 ∧ (n/2)∈ℤ ∧ p∈ℤ, then

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

Program code:

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

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

2:  ∫((Cot[d+e x])^m)(((a+b ((Sin[d+e x])^n)+c ((Sin[d+e x])^(2n))))^p)dx  when  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n|p)∈ℤ

Derivation: Algebraic expansion

Basis: ((Cot[z])^2)==((1-((Sin[z])^2))/((Sin[z])^2))

Rule: If  (m/2)∈ℤ ∧ (b^2)-4a c≠0 ∧ (n|p)∈ℤ, then

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

Proeram code:

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

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

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

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

1:  ∫(A+B Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[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 Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[d+e x])^2)))^n)dx  ⟶  (1/((4^n)(c^n)))∫(A+B Sin[d+e x])(((b+2c Sin[d+e x]))^(2n))dx

Program code:

Int[(A_+B_.*sin[d_.+e_.*x_])*(a_+b_.*sin[d_.+e_.*x_]+c_.*sin[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  1/(4^n*c^n)*Int[(A+B*Sin[d+e*x])*(b+2*c*Sin[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_.*cos[d_.+e_.*x_])*(a_+b_.*cos[d_.+e_.*x_]+c_.*cos[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  1/(4^n*c^n)*Int[(A+B*Cos[d+e*x])*(b+2*c*Cos[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 Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[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 Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[d+e x])^2)))^n)dx  ⟶  ((((a+b Sin[d+e x]+c ((Sin[d+e x])^2)))^n)/(((b+2 c Sin[d+e x]))^(2n)))∫(A+B Sin[d+e x])(((b+2c Sin[d+e x]))^(2n))dx

Program code:

Int[(A_+B_.*sin[d_.+e_.*x_])*(a_+b_.*sin[d_.+e_.*x_]+c_.*sin[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  (a+b*Sin[d+e*x]+c*Sin[d+e*x]^2)^n/(b+2*c*Sin[d+e*x])^(2*n)*Int[(A+B*Sin[d+e*x])*(b+2*c*Sin[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_.*cos[d_.+e_.*x_])*(a_+b_.*cos[d_.+e_.*x_]+c_.*cos[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  (a+b*Cos[d+e*x]+c*Cos[d+e*x]^2)^n/(b+2*c*Cos[d+e*x])^(2*n)*Int[(A+B*Cos[d+e*x])*(b+2*c*Cos[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 Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[d+e x])^2)))^n)dx  when  (b^2)-4a c≠0

1:  ∫((A+B Sin[d+e x])/(a+b Sin[d+e x]+c ((Sin[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 Sin[d+e x])/(a+b Sin[d+e x]+c ((Sin[d+e x])^2)))dx  ⟶  (B+((b B-2 A c)/q))∫(1/(b+q+2 c Sin[d+e x]))dx+(B-((b B-2 A c)/q))∫(1/(b-q+2 c Sin[d+e x]))dx

Program code:

Int[(A_+B_.*sin[d_.+e_.*x_])/(a_.+b_.*sin[d_.+e_.*x_]+c_.*sin[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*Sin[d+e*x]),x] + 
  (B-(b*B-2*A*c)/q)*Int[1/(b-q+2*c*Sin[d+e*x]),x]] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0]

Int[(A_+B_.*cos[d_.+e_.*x_])/(a_.+b_.*cos[d_.+e_.*x_]+c_.*cos[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*Cos[d+e*x]),x] + 
  (B-(b*B-2*A*c)/q)*Int[1/(b-q+2*c*Cos[d+e*x]),x]] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0]

2:  ∫(A+B Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[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 Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[d+e x])^2)))^n)dx  ⟶  ∫ExpandTrig[(A+B Sin[d+e x])(((a+b Sin[d+e x]+c ((Sin[d+e x])^2)))^n),x]dx

Program code:

Int[(A_+B_.*sin[d_.+e_.*x_])*(a_.+b_.*sin[d_.+e_.*x_]+c_.*sin[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  Int[ExpandTrig[(A+B*sin[d+e*x])*(a+b*sin[d+e*x]+c*sin[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_.*cos[d_.+e_.*x_])*(a_.+b_.*cos[d_.+e_.*x_]+c_.*cos[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  Int[ExpandTrig[(A+B*cos[d+e*x])*(a+b*cos[d+e*x]+c*cos[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]