Rules for integrands of the form(Subscript[P, q])[x] (((a+b x+c (x^2)))^p) whenq>1

1:  ∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  when p+2∈(SuperPlus[ℤ])

Derivation: Algebraic expansion

Rule 1.2.1.8.1: If  p+2∈(SuperPlus[ℤ]), then

∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  ⟶  ∫ ExpandIntegrand[(Subscript[P, q])[x] (((a+b x+c (x^2)))^p),x]dx

Program code:

Int[Pq_*(a_+b_.*x_+c_.*x_^2)^p_.,x_Symbol] :=
  Int[ExpandIntegrand[Pq*(a+b*x+c*x^2)^p,x],x] /;
FreeQ[{a,b,c},x] && PolyQ[Pq,x] && IGtQ[p,-2]

2:  ∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  when (Subscript[P, q])[x,0]==0

Derivation: Algebraic simplification

Rule 1.2.1.8.2: If  (Subscript[P, q])[x,0]==0, then

∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  ⟶  ∫x PolynomialQuotient[(Subscript[P, q])[x],x,x] (((a+b x+c (x^2)))^p)dx

Program code:

Int[Pq_*(a_.+b_.*x_+c_.*x_^2)^p_,x_Symbol] :=
  Int[x*PolynomialQuotient[Pq,x,x]*(a+b*x+c*x^2)^p,x] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x] && EqQ[Coeff[Pq,x,0],0] && Not[MatchQ[Pq,x^m_.*u_. /; IntegerQ[m]]]

3:  ∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  when (b^2)-4 a c==0

Derivation: Piecewise constant extraction

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

Rule 1.2.1.8.3: If  (b^2)-4 a c==0, then

∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  ⟶  ((((a+b x+c (x^2)))^(FracPart[p]))/((((4 c))^(IntPart[p])) (((b+2 c x))^(2 FracPart[p]))))∫(Subscript[P, q])[x](((b+2 c (x^2)))^(2 p))dx

Program code:

Int[Pq_*(a_+b_.*x_+c_.*x_^2)^p_,x_Symbol] :=
  (a+b*x+c*x^2)^FracPart[p]/((4*c)^IntPart[p]*(b+2*c*x)^(2*FracPart[p]))*Int[Pq*(b+2*c*x)^(2*p),x] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x] && EqQ[b^2-4*a*c,0]

4:  ∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  when (b^2)-4 a c≠0 ∧ p<-1

Derivation: Algebraic expansion and quadratic recurrence 2a

Rule 1.2.1.8.4: If  (b^2)-4 a c≠0 ∧ p<-1, 
    let (Subscript[Q, q-2])[x]->PolynomialQuotient[(Subscript[P, q])[x],a+b x+c (x^2),x]and f+g x->PolynomialRemainder[(Subscript[P, q])[x],a+b x+c (x^2),x], then

∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  ⟶  

∫(f+g x) (((a+b x+c (x^2)))^p)dx+∫(Subscript[Q, q-2])[x] (((a+b x+c (x^2)))^(p+1))dx  ⟶  

(( (b f-2 a g+(2 c f-b g) x)(((a+b x+c (x^2)))^(p+1)))/((p+1) ((b^2)-4 a c)))+(1/((p+1) ((b^2)-4 a c)))∫(((a+b x+c (x^2)))^(p+1))((p+1) ((b^2)-4 a c) (Subscript[Q, q-2])[x]-(2 p+3) (2 c f-b g)) dx

Program code:

Int[Pq_*(a_.+b_.*x_+c_.*x_^2)^p_,x_Symbol] :=
  With[{Q=PolynomialQuotient[Pq,a+b*x+c*x^2,x],
        f=Coeff[PolynomialRemainder[Pq,a+b*x+c*x^2,x],x,0],
        g=Coeff[PolynomialRemainder[Pq,a+b*x+c*x^2,x],x,1]},
  (b*f-2*a*g+(2*c*f-b*g)*x)*(a+b*x+c*x^2)^(p+1)/((p+1)*(b^2-4*a*c)) + 
  1/((p+1)*(b^2-4*a*c))*Int[(a+b*x+c*x^2)^(p+1)*ExpandToSum[(p+1)*(b^2-4*a*c)*Q-(2*p+3)*(2*c*f-b*g),x],x]] /;
FreeQ[{a,b,c},x] && PolyQ[Pq,x] && NeQ[b^2-4*a*c,0] && LtQ[p,-1]

5:  ∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  when (b^2)-4 a c≠0 ∧ p≰-1

Reference: G&R 2.160.3

Derivation: Trinomial recurrence 3a with A=0, B=1 and m=m-n

Reference: G&R 2.104

Note: This special case of the Ostrogradskiy-Hermite integration method reduces the degree of the polynomial in the resulting integrand.

Rule 1.2.1.8.5: If  (b^2)-4 a c≠0 ∧ p≰-1, let e->(Subscript[P, q])[x,q], then

∫(Subscript[P, q])[x] (((a+b x+c (x^2)))^p)dx  ⟶  

∫((Subscript[P, q])[x]-e (x^q)) (((a+b x+c (x^2)))^p)dx+e∫(x^q) (((a+b x+c (x^2)))^p)dx  ⟶  

((e (x^(q-1)) (((a+b x+c (x^2)))^(p+1)))/(c (q+2 p+1)))+(1/(c (q+2 p+1))) ∫(((a+b x+c (x^2)))^p)(c (q+2 p+1) (Subscript[P, q])[x]-a e (q-1) (x^(q-2))-b e (q+p) (x^(q-1))-c e (q+2 p+1) (x^q))dx

Program code:

Int[Pq_*(a_.+b_.*x_+c_.*x_^2)^p_,x_Symbol] :=
  With[{q=Expon[Pq,x],e=Coeff[Pq,x,Expon[Pq,x]]},
  e*x^(q-1)*(a+b*x+c*x^2)^(p+1)/(c*(q+2*p+1)) + 
  1/(c*(q+2*p+1))*Int[(a+b*x+c*x^2)^p*
    ExpandToSum[c*(q+2*p+1)*Pq-a*e*(q-1)*x^(q-2)-b*e*(q+p)*x^(q-1)-c*e*(q+2*p+1)*x^q,x],x]] /;
FreeQ[{a,b,c,p},x] && PolyQ[Pq,x] && NeQ[b^2-4*a*c,0] && Not[LeQ[p,-1]]