\(\int (a+b x+c x^2)^p (d (2 b^2-2 a c+b^2 p)+e (2 b^2-2 a c+b^2 p) x-c (2 c d-b e) (3+2 p) x^2) \, dx\) [23]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [B] (verification not implemented)
Maxima [B] (verification not implemented)
Giac [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 69, antiderivative size = 46 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=-\frac {(a e-b d (2+p)+(2 c d-b e) (1+p) x) \left (a+b x+c x^2\right )^{1+p}}{1+p} \] Output:

-(a*e-b*d*(2+p)+(-b*e+2*c*d)*(p+1)*x)*(c*x^2+b*x+a)^(p+1)/(p+1)
                                                                                    
                                                                                    
 

Mathematica [A] (verified)

Time = 1.08 (sec) , antiderivative size = 45, normalized size of antiderivative = 0.98 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=\frac {(-a e+b d (2+p)-2 c d (1+p) x+b e (1+p) x) (a+x (b+c x))^{1+p}}{1+p} \] Input:

Integrate[(a + b*x + c*x^2)^p*(d*(2*b^2 - 2*a*c + b^2*p) + e*(2*b^2 - 2*a* 
c + b^2*p)*x - c*(2*c*d - b*e)*(3 + 2*p)*x^2),x]
 

Output:

((-(a*e) + b*d*(2 + p) - 2*c*d*(1 + p)*x + b*e*(1 + p)*x)*(a + x*(b + c*x) 
)^(1 + p))/(1 + p)
 

Rubi [A] (verified)

Time = 0.29 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.28, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.058, Rules used = {2192, 25, 27, 1104}

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 \left (a+b x+c x^2\right )^p \left (d \left (-2 a c+b^2 p+2 b^2\right )+e x \left (-2 a c+b^2 p+2 b^2\right )-c (2 p+3) x^2 (2 c d-b e)\right ) \, dx\)

\(\Big \downarrow \) 2192

\(\displaystyle \frac {\int -c (2 p+3) (b (a e-b d (p+2))+2 c x (a e-b d (p+2))) \left (c x^2+b x+a\right )^pdx}{c (2 p+3)}-x (2 c d-b e) \left (a+b x+c x^2\right )^{p+1}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {\int c (2 p+3) (a e-b d (p+2)) (b+2 c x) \left (c x^2+b x+a\right )^pdx}{c (2 p+3)}-\left (x (2 c d-b e) \left (a+b x+c x^2\right )^{p+1}\right )\)

\(\Big \downarrow \) 27

\(\displaystyle -(a e-b d (p+2)) \int (b+2 c x) \left (c x^2+b x+a\right )^pdx-\left (x (2 c d-b e) \left (a+b x+c x^2\right )^{p+1}\right )\)

\(\Big \downarrow \) 1104

\(\displaystyle -\frac {\left (a+b x+c x^2\right )^{p+1} (a e-b d (p+2))}{p+1}-x (2 c d-b e) \left (a+b x+c x^2\right )^{p+1}\)

Input:

Int[(a + b*x + c*x^2)^p*(d*(2*b^2 - 2*a*c + b^2*p) + e*(2*b^2 - 2*a*c + b^ 
2*p)*x - c*(2*c*d - b*e)*(3 + 2*p)*x^2),x]
 

Output:

-(((a*e - b*d*(2 + p))*(a + b*x + c*x^2)^(1 + p))/(1 + p)) - (2*c*d - b*e) 
*x*(a + b*x + c*x^2)^(1 + p)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 1104
Int[((d_) + (e_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol 
] :> Simp[d*((a + b*x + c*x^2)^(p + 1)/(b*(p + 1))), x] /; FreeQ[{a, b, c, 
d, e, p}, x] && EqQ[2*c*d - b*e, 0]
 

rule 2192
Int[(Pq_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{q = 
Expon[Pq, x], e = Coeff[Pq, x, Expon[Pq, x]]}, Simp[e*x^(q - 1)*((a + b*x + 
 c*x^2)^(p + 1)/(c*(q + 2*p + 1))), x] + Simp[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], x]] /; FreeQ[{a, b, c 
, p}, x] && PolyQ[Pq, x] && NeQ[b^2 - 4*a*c, 0] &&  !LeQ[p, -1]
 
Maple [A] (verified)

Time = 1.50 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.24

method result size
gosper \(-\frac {\left (c \,x^{2}+b x +a \right )^{p +1} \left (-b e p x +2 c d x p -b d p -b e x +2 c d x +a e -2 b d \right )}{p +1}\) \(57\)
risch \(-\frac {\left (-b c e p \,x^{3}+2 c^{2} d p \,x^{3}-b^{2} e p \,x^{2}+b c d p \,x^{2}-b c e \,x^{3}+2 c^{2} d \,x^{3}-a b e p x +2 a c d p x +a c e \,x^{2}-b^{2} d p x -b^{2} e \,x^{2}-a b d p +2 a d x c -2 b^{2} d x +a^{2} e -2 d a b \right ) \left (c \,x^{2}+b x +a \right )^{p}}{p +1}\) \(142\)
norman \(\left (b e -2 c d \right ) c \,x^{3} {\mathrm e}^{p \ln \left (c \,x^{2}+b x +a \right )}+\frac {\left (a b e p -2 a c d p +b^{2} d p -2 a c d +2 b^{2} d \right ) x \,{\mathrm e}^{p \ln \left (c \,x^{2}+b x +a \right )}}{p +1}-\frac {a \left (-b d p +a e -2 b d \right ) {\mathrm e}^{p \ln \left (c \,x^{2}+b x +a \right )}}{p +1}-\frac {\left (-b^{2} e p +b c d p +a c e -e \,b^{2}\right ) x^{2} {\mathrm e}^{p \ln \left (c \,x^{2}+b x +a \right )}}{p +1}\) \(161\)
orering \(\frac {\left (-b e p x +2 c d x p -b d p -b e x +2 c d x +a e -2 b d \right ) \left (c \,x^{2}+b x +a \right ) \left (c \,x^{2}+b x +a \right )^{p} \left (d \left (b^{2} p -2 a c +2 b^{2}\right )+e \left (b^{2} p -2 a c +2 b^{2}\right ) x -c \left (-b e +2 c d \right ) \left (3+2 p \right ) x^{2}\right )}{\left (p +1\right ) \left (-2 b c e p \,x^{2}+4 c^{2} d \,x^{2} p -b^{2} e p x -3 b c e \,x^{2}+6 c^{2} d \,x^{2}+2 a c e x -b^{2} d p -2 b^{2} e x +2 a c d -2 b^{2} d \right )}\) \(198\)
parallelrisch \(\frac {x^{3} \left (c \,x^{2}+b x +a \right )^{p} a b c e p -2 x^{3} \left (c \,x^{2}+b x +a \right )^{p} a \,c^{2} d p +x^{3} \left (c \,x^{2}+b x +a \right )^{p} a b c e -2 x^{3} \left (c \,x^{2}+b x +a \right )^{p} a \,c^{2} d +x^{2} \left (c \,x^{2}+b x +a \right )^{p} a \,b^{2} e p -x^{2} \left (c \,x^{2}+b x +a \right )^{p} a b c d p -x^{2} \left (c \,x^{2}+b x +a \right )^{p} a^{2} c e +x^{2} \left (c \,x^{2}+b x +a \right )^{p} a \,b^{2} e +x \left (c \,x^{2}+b x +a \right )^{p} a^{2} b e p -2 x \left (c \,x^{2}+b x +a \right )^{p} a^{2} c d p +x \left (c \,x^{2}+b x +a \right )^{p} a \,b^{2} d p -2 x \left (c \,x^{2}+b x +a \right )^{p} a^{2} c d +2 x \left (c \,x^{2}+b x +a \right )^{p} a \,b^{2} d +\left (c \,x^{2}+b x +a \right )^{p} a^{2} b d p -\left (c \,x^{2}+b x +a \right )^{p} a^{3} e +2 \left (c \,x^{2}+b x +a \right )^{p} a^{2} b d}{\left (p +1\right ) a}\) \(341\)

Input:

int((c*x^2+b*x+a)^p*(d*(b^2*p-2*a*c+2*b^2)+e*(b^2*p-2*a*c+2*b^2)*x-c*(-b*e 
+2*c*d)*(3+2*p)*x^2),x,method=_RETURNVERBOSE)
 

Output:

-1/(p+1)*(c*x^2+b*x+a)^(p+1)*(-b*e*p*x+2*c*d*p*x-b*d*p-b*e*x+2*c*d*x+a*e-2 
*b*d)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 126 vs. \(2 (46) = 92\).

Time = 0.08 (sec) , antiderivative size = 126, normalized size of antiderivative = 2.74 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=\frac {{\left (a b d p - {\left (2 \, c^{2} d - b c e + {\left (2 \, c^{2} d - b c e\right )} p\right )} x^{3} + 2 \, a b d - a^{2} e + {\left ({\left (b^{2} - a c\right )} e - {\left (b c d - b^{2} e\right )} p\right )} x^{2} + {\left (2 \, {\left (b^{2} - a c\right )} d + {\left (a b e + {\left (b^{2} - 2 \, a c\right )} d\right )} p\right )} x\right )} {\left (c x^{2} + b x + a\right )}^{p}}{p + 1} \] Input:

integrate((c*x^2+b*x+a)^p*(d*(b^2*p-2*a*c+2*b^2)+e*(b^2*p-2*a*c+2*b^2)*x-c 
*(-b*e+2*c*d)*(3+2*p)*x^2),x, algorithm="fricas")
 

Output:

(a*b*d*p - (2*c^2*d - b*c*e + (2*c^2*d - b*c*e)*p)*x^3 + 2*a*b*d - a^2*e + 
 ((b^2 - a*c)*e - (b*c*d - b^2*e)*p)*x^2 + (2*(b^2 - a*c)*d + (a*b*e + (b^ 
2 - 2*a*c)*d)*p)*x)*(c*x^2 + b*x + a)^p/(p + 1)
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 507 vs. \(2 (39) = 78\).

Time = 69.18 (sec) , antiderivative size = 507, normalized size of antiderivative = 11.02 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=\begin {cases} - \frac {a^{2} e \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {a b d p \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {2 a b d \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {a b e p x \left (a + b x + c x^{2}\right )^{p}}{p + 1} - \frac {2 a c d p x \left (a + b x + c x^{2}\right )^{p}}{p + 1} - \frac {2 a c d x \left (a + b x + c x^{2}\right )^{p}}{p + 1} - \frac {a c e x^{2} \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {b^{2} d p x \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {2 b^{2} d x \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {b^{2} e p x^{2} \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {b^{2} e x^{2} \left (a + b x + c x^{2}\right )^{p}}{p + 1} - \frac {b c d p x^{2} \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {b c e p x^{3} \left (a + b x + c x^{2}\right )^{p}}{p + 1} + \frac {b c e x^{3} \left (a + b x + c x^{2}\right )^{p}}{p + 1} - \frac {2 c^{2} d p x^{3} \left (a + b x + c x^{2}\right )^{p}}{p + 1} - \frac {2 c^{2} d x^{3} \left (a + b x + c x^{2}\right )^{p}}{p + 1} & \text {for}\: p \neq -1 \\- a e \log {\left (\frac {b}{2 c} + x - \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )} - a e \log {\left (\frac {b}{2 c} + x + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )} + b d \log {\left (\frac {b}{2 c} + x - \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )} + b d \log {\left (\frac {b}{2 c} + x + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )} + b e x - 2 c d x & \text {otherwise} \end {cases} \] Input:

integrate((c*x**2+b*x+a)**p*(d*(b**2*p-2*a*c+2*b**2)+e*(b**2*p-2*a*c+2*b** 
2)*x-c*(-b*e+2*c*d)*(3+2*p)*x**2),x)
 

Output:

Piecewise((-a**2*e*(a + b*x + c*x**2)**p/(p + 1) + a*b*d*p*(a + b*x + c*x* 
*2)**p/(p + 1) + 2*a*b*d*(a + b*x + c*x**2)**p/(p + 1) + a*b*e*p*x*(a + b* 
x + c*x**2)**p/(p + 1) - 2*a*c*d*p*x*(a + b*x + c*x**2)**p/(p + 1) - 2*a*c 
*d*x*(a + b*x + c*x**2)**p/(p + 1) - a*c*e*x**2*(a + b*x + c*x**2)**p/(p + 
 1) + b**2*d*p*x*(a + b*x + c*x**2)**p/(p + 1) + 2*b**2*d*x*(a + b*x + c*x 
**2)**p/(p + 1) + b**2*e*p*x**2*(a + b*x + c*x**2)**p/(p + 1) + b**2*e*x** 
2*(a + b*x + c*x**2)**p/(p + 1) - b*c*d*p*x**2*(a + b*x + c*x**2)**p/(p + 
1) + b*c*e*p*x**3*(a + b*x + c*x**2)**p/(p + 1) + b*c*e*x**3*(a + b*x + c* 
x**2)**p/(p + 1) - 2*c**2*d*p*x**3*(a + b*x + c*x**2)**p/(p + 1) - 2*c**2* 
d*x**3*(a + b*x + c*x**2)**p/(p + 1), Ne(p, -1)), (-a*e*log(b/(2*c) + x - 
sqrt(-4*a*c + b**2)/(2*c)) - a*e*log(b/(2*c) + x + sqrt(-4*a*c + b**2)/(2* 
c)) + b*d*log(b/(2*c) + x - sqrt(-4*a*c + b**2)/(2*c)) + b*d*log(b/(2*c) + 
 x + sqrt(-4*a*c + b**2)/(2*c)) + b*e*x - 2*c*d*x, True))
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 106 vs. \(2 (46) = 92\).

Time = 0.07 (sec) , antiderivative size = 106, normalized size of antiderivative = 2.30 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=\frac {{\left (a b d {\left (p + 2\right )} - {\left (2 \, c^{2} d {\left (p + 1\right )} - b c e {\left (p + 1\right )}\right )} x^{3} - a^{2} e + {\left (b^{2} e {\left (p + 1\right )} - b c d p - a c e\right )} x^{2} + {\left (b^{2} d {\left (p + 2\right )} - {\left (2 \, c d {\left (p + 1\right )} - b e p\right )} a\right )} x\right )} {\left (c x^{2} + b x + a\right )}^{p}}{p + 1} \] Input:

integrate((c*x^2+b*x+a)^p*(d*(b^2*p-2*a*c+2*b^2)+e*(b^2*p-2*a*c+2*b^2)*x-c 
*(-b*e+2*c*d)*(3+2*p)*x^2),x, algorithm="maxima")
 

Output:

(a*b*d*(p + 2) - (2*c^2*d*(p + 1) - b*c*e*(p + 1))*x^3 - a^2*e + (b^2*e*(p 
 + 1) - b*c*d*p - a*c*e)*x^2 + (b^2*d*(p + 2) - (2*c*d*(p + 1) - b*e*p)*a) 
*x)*(c*x^2 + b*x + a)^p/(p + 1)
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 321 vs. \(2 (46) = 92\).

Time = 0.13 (sec) , antiderivative size = 321, normalized size of antiderivative = 6.98 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=-\frac {2 \, {\left (c x^{2} + b x + a\right )}^{p} c^{2} d p x^{3} - {\left (c x^{2} + b x + a\right )}^{p} b c e p x^{3} + {\left (c x^{2} + b x + a\right )}^{p} b c d p x^{2} - {\left (c x^{2} + b x + a\right )}^{p} b^{2} e p x^{2} + 2 \, {\left (c x^{2} + b x + a\right )}^{p} c^{2} d x^{3} - {\left (c x^{2} + b x + a\right )}^{p} b c e x^{3} - {\left (c x^{2} + b x + a\right )}^{p} b^{2} d p x + 2 \, {\left (c x^{2} + b x + a\right )}^{p} a c d p x - {\left (c x^{2} + b x + a\right )}^{p} a b e p x - {\left (c x^{2} + b x + a\right )}^{p} b^{2} e x^{2} + {\left (c x^{2} + b x + a\right )}^{p} a c e x^{2} - {\left (c x^{2} + b x + a\right )}^{p} a b d p - 2 \, {\left (c x^{2} + b x + a\right )}^{p} b^{2} d x + 2 \, {\left (c x^{2} + b x + a\right )}^{p} a c d x - 2 \, {\left (c x^{2} + b x + a\right )}^{p} a b d + {\left (c x^{2} + b x + a\right )}^{p} a^{2} e}{p + 1} \] Input:

integrate((c*x^2+b*x+a)^p*(d*(b^2*p-2*a*c+2*b^2)+e*(b^2*p-2*a*c+2*b^2)*x-c 
*(-b*e+2*c*d)*(3+2*p)*x^2),x, algorithm="giac")
 

Output:

-(2*(c*x^2 + b*x + a)^p*c^2*d*p*x^3 - (c*x^2 + b*x + a)^p*b*c*e*p*x^3 + (c 
*x^2 + b*x + a)^p*b*c*d*p*x^2 - (c*x^2 + b*x + a)^p*b^2*e*p*x^2 + 2*(c*x^2 
 + b*x + a)^p*c^2*d*x^3 - (c*x^2 + b*x + a)^p*b*c*e*x^3 - (c*x^2 + b*x + a 
)^p*b^2*d*p*x + 2*(c*x^2 + b*x + a)^p*a*c*d*p*x - (c*x^2 + b*x + a)^p*a*b* 
e*p*x - (c*x^2 + b*x + a)^p*b^2*e*x^2 + (c*x^2 + b*x + a)^p*a*c*e*x^2 - (c 
*x^2 + b*x + a)^p*a*b*d*p - 2*(c*x^2 + b*x + a)^p*b^2*d*x + 2*(c*x^2 + b*x 
 + a)^p*a*c*d*x - 2*(c*x^2 + b*x + a)^p*a*b*d + (c*x^2 + b*x + a)^p*a^2*e) 
/(p + 1)
 

Mupad [B] (verification not implemented)

Time = 17.10 (sec) , antiderivative size = 115, normalized size of antiderivative = 2.50 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx={\left (c\,x^2+b\,x+a\right )}^p\,\left (\frac {a\,\left (2\,b\,d-a\,e+b\,d\,p\right )}{p+1}+c\,x^3\,\left (b\,e-2\,c\,d\right )+\frac {x\,\left (2\,b^2\,d-2\,a\,c\,d+b^2\,d\,p+a\,b\,e\,p-2\,a\,c\,d\,p\right )}{p+1}+\frac {x^2\,\left (b^2\,e-a\,c\,e+b^2\,e\,p-b\,c\,d\,p\right )}{p+1}\right ) \] Input:

int((d*(b^2*p - 2*a*c + 2*b^2) + e*x*(b^2*p - 2*a*c + 2*b^2) + c*x^2*(2*p 
+ 3)*(b*e - 2*c*d))*(a + b*x + c*x^2)^p,x)
 

Output:

(a + b*x + c*x^2)^p*((a*(2*b*d - a*e + b*d*p))/(p + 1) + c*x^3*(b*e - 2*c* 
d) + (x*(2*b^2*d - 2*a*c*d + b^2*d*p + a*b*e*p - 2*a*c*d*p))/(p + 1) + (x^ 
2*(b^2*e - a*c*e + b^2*e*p - b*c*d*p))/(p + 1))
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 136, normalized size of antiderivative = 2.96 \[ \int \left (a+b x+c x^2\right )^p \left (d \left (2 b^2-2 a c+b^2 p\right )+e \left (2 b^2-2 a c+b^2 p\right ) x-c (2 c d-b e) (3+2 p) x^2\right ) \, dx=\frac {\left (c \,x^{2}+b x +a \right )^{p} \left (b c e p \,x^{3}-2 c^{2} d p \,x^{3}+b^{2} e p \,x^{2}-b c d p \,x^{2}+b c e \,x^{3}-2 c^{2} d \,x^{3}+a b e p x -2 a c d p x -a c e \,x^{2}+b^{2} d p x +b^{2} e \,x^{2}+a b d p -2 a c d x +2 b^{2} d x -a^{2} e +2 a b d \right )}{p +1} \] Input:

int((c*x^2+b*x+a)^p*(d*(b^2*p-2*a*c+2*b^2)+e*(b^2*p-2*a*c+2*b^2)*x-c*(-b*e 
+2*c*d)*(3+2*p)*x^2),x)
 

Output:

((a + b*x + c*x**2)**p*( - a**2*e + a*b*d*p + 2*a*b*d + a*b*e*p*x - 2*a*c* 
d*p*x - 2*a*c*d*x - a*c*e*x**2 + b**2*d*p*x + 2*b**2*d*x + b**2*e*p*x**2 + 
 b**2*e*x**2 - b*c*d*p*x**2 + b*c*e*p*x**3 + b*c*e*x**3 - 2*c**2*d*p*x**3 
- 2*c**2*d*x**3))/(p + 1)