\(\int \frac {(f+g x) (a+b x+c x^2)^p}{(d+e x)^2} \, dx\) [1123]

Optimal result
Mathematica [A] (warning: unable to verify)
Rubi [A] (warning: unable to verify)
Maple [F]
Fricas [F]
Sympy [F(-1)]
Maxima [F]
Giac [F(-2)]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 25, antiderivative size = 408 \[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=-\frac {(e f-d g) \left (a+b x+c x^2\right )^{1+p}}{\left (c d^2-b d e+a e^2\right ) (d+e x)}+\frac {2^{-1+2 p} (e (a e g+b e f p-b d g (1+p))-c d (2 e f p-d (g+2 g p))) \left (\frac {e \left (b-\sqrt {b^2-4 a c}+2 c x\right )}{c (d+e x)}\right )^{-p} \left (\frac {e \left (b+\sqrt {b^2-4 a c}+2 c x\right )}{c (d+e x)}\right )^{-p} \left (a+b x+c x^2\right )^p \operatorname {AppellF1}\left (-2 p,-p,-p,1-2 p,\frac {2 c d-\left (b-\sqrt {b^2-4 a c}\right ) e}{2 c (d+e x)},\frac {2 d-\frac {\left (b+\sqrt {b^2-4 a c}\right ) e}{c}}{2 (d+e x)}\right )}{e^2 \left (c d^2-b d e+a e^2\right ) p}+\frac {2^{-1-2 p} (e f-d g) (1+2 p) (b+2 c x) \left (a+b x+c x^2\right )^p \left (-\frac {c \left (a+b x+c x^2\right )}{b^2-4 a c}\right )^{-p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-p,\frac {3}{2},\frac {(b+2 c x)^2}{b^2-4 a c}\right )}{e \left (c d^2-b d e+a e^2\right )} \] Output:

-(-d*g+e*f)*(c*x^2+b*x+a)^(p+1)/(a*e^2-b*d*e+c*d^2)/(e*x+d)+2^(-1+2*p)*(e* 
(a*e*g+b*e*f*p-b*d*g*(p+1))-c*d*(2*e*f*p-d*(2*g*p+g)))*(c*x^2+b*x+a)^p*App 
ellF1(-2*p,-p,-p,1-2*p,(2*d-(b+(-4*a*c+b^2)^(1/2))*e/c)/(2*e*x+2*d),1/2*(2 
*c*d-(b-(-4*a*c+b^2)^(1/2))*e)/c/(e*x+d))/e^2/(a*e^2-b*d*e+c*d^2)/p/((e*(b 
-(-4*a*c+b^2)^(1/2)+2*c*x)/c/(e*x+d))^p)/((e*(b+(-4*a*c+b^2)^(1/2)+2*c*x)/ 
c/(e*x+d))^p)+2^(-1-2*p)*(-d*g+e*f)*(1+2*p)*(2*c*x+b)*(c*x^2+b*x+a)^p*hype 
rgeom([1/2, -p],[3/2],(2*c*x+b)^2/(-4*a*c+b^2))/e/(a*e^2-b*d*e+c*d^2)/((-c 
*(c*x^2+b*x+a)/(-4*a*c+b^2))^p)
 

Mathematica [A] (warning: unable to verify)

Time = 1.57 (sec) , antiderivative size = 309, normalized size of antiderivative = 0.76 \[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\frac {2^{-1+2 p} \left (\frac {e \left (b-\sqrt {b^2-4 a c}+2 c x\right )}{c (d+e x)}\right )^{-p} \left (\frac {e \left (b+\sqrt {b^2-4 a c}+2 c x\right )}{c (d+e x)}\right )^{-p} (a+x (b+c x))^p \left (2 (e f-d g) p \operatorname {AppellF1}\left (1-2 p,-p,-p,2-2 p,\frac {2 c d-\left (b+\sqrt {b^2-4 a c}\right ) e}{2 c (d+e x)},\frac {2 c d-b e+\sqrt {b^2-4 a c} e}{2 c d+2 c e x}\right )+g (-1+2 p) (d+e x) \operatorname {AppellF1}\left (-2 p,-p,-p,1-2 p,\frac {2 c d-\left (b+\sqrt {b^2-4 a c}\right ) e}{2 c (d+e x)},\frac {2 c d-b e+\sqrt {b^2-4 a c} e}{2 c d+2 c e x}\right )\right )}{e^2 p (-1+2 p) (d+e x)} \] Input:

Integrate[((f + g*x)*(a + b*x + c*x^2)^p)/(d + e*x)^2,x]
 

Output:

(2^(-1 + 2*p)*(a + x*(b + c*x))^p*(2*(e*f - d*g)*p*AppellF1[1 - 2*p, -p, - 
p, 2 - 2*p, (2*c*d - (b + Sqrt[b^2 - 4*a*c])*e)/(2*c*(d + e*x)), (2*c*d - 
b*e + Sqrt[b^2 - 4*a*c]*e)/(2*c*d + 2*c*e*x)] + g*(-1 + 2*p)*(d + e*x)*App 
ellF1[-2*p, -p, -p, 1 - 2*p, (2*c*d - (b + Sqrt[b^2 - 4*a*c])*e)/(2*c*(d + 
 e*x)), (2*c*d - b*e + Sqrt[b^2 - 4*a*c]*e)/(2*c*d + 2*c*e*x)]))/(e^2*p*(- 
1 + 2*p)*((e*(b - Sqrt[b^2 - 4*a*c] + 2*c*x))/(c*(d + e*x)))^p*((e*(b + Sq 
rt[b^2 - 4*a*c] + 2*c*x))/(c*(d + e*x)))^p*(d + e*x))
 

Rubi [A] (warning: unable to verify)

Time = 1.17 (sec) , antiderivative size = 433, normalized size of antiderivative = 1.06, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {1237, 25, 1269, 1096, 1178, 150}

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

\(\Big \downarrow \) 1237

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 1269

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

\(\Big \downarrow \) 1096

\(\displaystyle \frac {\frac {(e (a e g-b d g (p+1)+b e f p)-c d (2 e f p-d (2 g p+g))) \int \frac {\left (c x^2+b x+a\right )^p}{d+e x}dx}{e}-\frac {c 2^{p+1} (2 p+1) (e f-d g) \left (-\frac {-\sqrt {b^2-4 a c}+b+2 c x}{\sqrt {b^2-4 a c}}\right )^{-p-1} \left (a+b x+c x^2\right )^{p+1} \operatorname {Hypergeometric2F1}\left (-p,p+1,p+2,\frac {b+2 c x+\sqrt {b^2-4 a c}}{2 \sqrt {b^2-4 a c}}\right )}{e (p+1) \sqrt {b^2-4 a c}}}{a e^2-b d e+c d^2}-\frac {(e f-d g) \left (a+b x+c x^2\right )^{p+1}}{(d+e x) \left (a e^2-b d e+c d^2\right )}\)

\(\Big \downarrow \) 1178

\(\displaystyle \frac {-\frac {4^p \left (\frac {1}{d+e x}\right )^{2 p} \left (a+b x+c x^2\right )^p \left (\frac {e \left (-\sqrt {b^2-4 a c}+b+2 c x\right )}{c (d+e x)}\right )^{-p} \left (\frac {e \left (\sqrt {b^2-4 a c}+b+2 c x\right )}{c (d+e x)}\right )^{-p} (e (a e g-b d g (p+1)+b e f p)-c d (2 e f p-d (2 g p+g))) \int \left (\frac {1}{d+e x}\right )^{-2 p-1} \left (1-\frac {2 d-\frac {\left (b-\sqrt {b^2-4 a c}\right ) e}{c}}{2 (d+e x)}\right )^p \left (1-\frac {2 d-\frac {\left (b+\sqrt {b^2-4 a c}\right ) e}{c}}{2 (d+e x)}\right )^pd\frac {1}{d+e x}}{e^2}-\frac {c 2^{p+1} (2 p+1) (e f-d g) \left (a+b x+c x^2\right )^{p+1} \left (-\frac {-\sqrt {b^2-4 a c}+b+2 c x}{\sqrt {b^2-4 a c}}\right )^{-p-1} \operatorname {Hypergeometric2F1}\left (-p,p+1,p+2,\frac {b+2 c x+\sqrt {b^2-4 a c}}{2 \sqrt {b^2-4 a c}}\right )}{e (p+1) \sqrt {b^2-4 a c}}}{a e^2-b d e+c d^2}-\frac {(e f-d g) \left (a+b x+c x^2\right )^{p+1}}{(d+e x) \left (a e^2-b d e+c d^2\right )}\)

\(\Big \downarrow \) 150

\(\displaystyle \frac {\frac {2^{2 p-1} \left (a+b x+c x^2\right )^p \left (\frac {e \left (-\sqrt {b^2-4 a c}+b+2 c x\right )}{c (d+e x)}\right )^{-p} \left (\frac {e \left (\sqrt {b^2-4 a c}+b+2 c x\right )}{c (d+e x)}\right )^{-p} \operatorname {AppellF1}\left (-2 p,-p,-p,1-2 p,\frac {2 c d-\left (b-\sqrt {b^2-4 a c}\right ) e}{2 c (d+e x)},\frac {2 d-\frac {\left (b+\sqrt {b^2-4 a c}\right ) e}{c}}{2 (d+e x)}\right ) (e (a e g-b d g (p+1)+b e f p)-c d (2 e f p-d (2 g p+g)))}{e^2 p}-\frac {c 2^{p+1} (2 p+1) (e f-d g) \left (-\frac {-\sqrt {b^2-4 a c}+b+2 c x}{\sqrt {b^2-4 a c}}\right )^{-p-1} \left (a+b x+c x^2\right )^{p+1} \operatorname {Hypergeometric2F1}\left (-p,p+1,p+2,\frac {b+2 c x+\sqrt {b^2-4 a c}}{2 \sqrt {b^2-4 a c}}\right )}{e (p+1) \sqrt {b^2-4 a c}}}{a e^2-b d e+c d^2}-\frac {(e f-d g) \left (a+b x+c x^2\right )^{p+1}}{(d+e x) \left (a e^2-b d e+c d^2\right )}\)

Input:

Int[((f + g*x)*(a + b*x + c*x^2)^p)/(d + e*x)^2,x]
 

Output:

-(((e*f - d*g)*(a + b*x + c*x^2)^(1 + p))/((c*d^2 - b*d*e + a*e^2)*(d + e* 
x))) + ((2^(-1 + 2*p)*(e*(a*e*g + b*e*f*p - b*d*g*(1 + p)) - c*d*(2*e*f*p 
- d*(g + 2*g*p)))*(a + b*x + c*x^2)^p*AppellF1[-2*p, -p, -p, 1 - 2*p, (2*c 
*d - (b - Sqrt[b^2 - 4*a*c])*e)/(2*c*(d + e*x)), (2*d - ((b + Sqrt[b^2 - 4 
*a*c])*e)/c)/(2*(d + e*x))])/(e^2*p*((e*(b - Sqrt[b^2 - 4*a*c] + 2*c*x))/( 
c*(d + e*x)))^p*((e*(b + Sqrt[b^2 - 4*a*c] + 2*c*x))/(c*(d + e*x)))^p) - ( 
2^(1 + p)*c*(e*f - d*g)*(1 + 2*p)*(-((b - Sqrt[b^2 - 4*a*c] + 2*c*x)/Sqrt[ 
b^2 - 4*a*c]))^(-1 - p)*(a + b*x + c*x^2)^(1 + p)*Hypergeometric2F1[-p, 1 
+ p, 2 + p, (b + Sqrt[b^2 - 4*a*c] + 2*c*x)/(2*Sqrt[b^2 - 4*a*c])])/(Sqrt[ 
b^2 - 4*a*c]*e*(1 + p)))/(c*d^2 - b*d*e + a*e^2)
 

Defintions of rubi rules used

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

rule 150
Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_)*((e_) + (f_.)*(x_))^(p_), x_ 
] :> Simp[c^n*e^p*((b*x)^(m + 1)/(b*(m + 1)))*AppellF1[m + 1, -n, -p, m + 2 
, (-d)*(x/c), (-f)*(x/e)], x] /; FreeQ[{b, c, d, e, f, m, n, p}, x] &&  !In 
tegerQ[m] &&  !IntegerQ[n] && GtQ[c, 0] && (IntegerQ[p] || GtQ[e, 0])
 

rule 1096
Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{q = Rt[b^2 
 - 4*a*c, 2]}, Simp[(-(a + b*x + c*x^2)^(p + 1)/(q*(p + 1)*((q - b - 2*c*x) 
/(2*q))^(p + 1)))*Hypergeometric2F1[-p, p + 1, p + 2, (b + q + 2*c*x)/(2*q) 
], x]] /; FreeQ[{a, b, c, p}, x] &&  !IntegerQ[4*p] &&  !IntegerQ[3*p]
 

rule 1178
Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_S 
ymbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Simp[(-(1/(d + e*x))^(2*p))*((a + 
b*x + c*x^2)^p/(e*(e*((b - q + 2*c*x)/(2*c*(d + e*x))))^p*(e*((b + q + 2*c* 
x)/(2*c*(d + e*x))))^p))   Subst[Int[x^(-m - 2*(p + 1))*Simp[1 - (d - e*((b 
 - q)/(2*c)))*x, x]^p*Simp[1 - (d - e*((b + q)/(2*c)))*x, x]^p, x], x, 1/(d 
 + e*x)], x]] /; FreeQ[{a, b, c, d, e, p}, x] && ILtQ[m, 0]
 

rule 1237
Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c 
_.)*(x_)^2)^(p_.), x_Symbol] :> Simp[(e*f - d*g)*(d + e*x)^(m + 1)*((a + b* 
x + c*x^2)^(p + 1)/((m + 1)*(c*d^2 - b*d*e + a*e^2))), x] + Simp[1/((m + 1) 
*(c*d^2 - b*d*e + a*e^2))   Int[(d + e*x)^(m + 1)*(a + b*x + c*x^2)^p*Simp[ 
(c*d*f - f*b*e + a*e*g)*(m + 1) + b*(d*g - e*f)*(p + 1) - c*(e*f - d*g)*(m 
+ 2*p + 3)*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && LtQ[m, -1 
] && (IntegerQ[m] || IntegerQ[p] || IntegersQ[2*m, 2*p])
 

rule 1269
Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c 
_.)*(x_)^2)^(p_.), x_Symbol] :> Simp[g/e   Int[(d + e*x)^(m + 1)*(a + b*x + 
 c*x^2)^p, x], x] + Simp[(e*f - d*g)/e   Int[(d + e*x)^m*(a + b*x + c*x^2)^ 
p, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, p}, x] &&  !IGtQ[m, 0]
 
Maple [F]

\[\int \frac {\left (g x +f \right ) \left (c \,x^{2}+b x +a \right )^{p}}{\left (e x +d \right )^{2}}d x\]

Input:

int((g*x+f)*(c*x^2+b*x+a)^p/(e*x+d)^2,x)
 

Output:

int((g*x+f)*(c*x^2+b*x+a)^p/(e*x+d)^2,x)
 

Fricas [F]

\[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\int { \frac {{\left (g x + f\right )} {\left (c x^{2} + b x + a\right )}^{p}}{{\left (e x + d\right )}^{2}} \,d x } \] Input:

integrate((g*x+f)*(c*x^2+b*x+a)^p/(e*x+d)^2,x, algorithm="fricas")
 

Output:

integral((g*x + f)*(c*x^2 + b*x + a)^p/(e^2*x^2 + 2*d*e*x + d^2), x)
 

Sympy [F(-1)]

Timed out. \[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\text {Timed out} \] Input:

integrate((g*x+f)*(c*x**2+b*x+a)**p/(e*x+d)**2,x)
 

Output:

Timed out
 

Maxima [F]

\[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\int { \frac {{\left (g x + f\right )} {\left (c x^{2} + b x + a\right )}^{p}}{{\left (e x + d\right )}^{2}} \,d x } \] Input:

integrate((g*x+f)*(c*x^2+b*x+a)^p/(e*x+d)^2,x, algorithm="maxima")
 

Output:

integrate((g*x + f)*(c*x^2 + b*x + a)^p/(e*x + d)^2, x)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\text {Exception raised: TypeError} \] Input:

integrate((g*x+f)*(c*x^2+b*x+a)^p/(e*x+d)^2,x, algorithm="giac")
 

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Unable to divide, perhaps due to ro 
unding error%%%{-1,[0,1,1,1,0,0]%%%}+%%%{1,[0,0,0,1,1,1]%%%} / %%%{1,[0,0, 
0,0,1,0]%
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\int \frac {\left (f+g\,x\right )\,{\left (c\,x^2+b\,x+a\right )}^p}{{\left (d+e\,x\right )}^2} \,d x \] Input:

int(((f + g*x)*(a + b*x + c*x^2)^p)/(d + e*x)^2,x)
 

Output:

int(((f + g*x)*(a + b*x + c*x^2)^p)/(d + e*x)^2, x)
 

Reduce [F]

\[ \int \frac {(f+g x) \left (a+b x+c x^2\right )^p}{(d+e x)^2} \, dx=\text {too large to display} \] Input:

int((g*x+f)*(c*x^2+b*x+a)^p/(e*x+d)^2,x)
                                                                                    
                                                                                    
 

Output:

(2*(a + b*x + c*x**2)**p*a*e*g*p - (a + b*x + c*x**2)**p*b*d*g*p - (a + b* 
x + c*x**2)**p*b*d*g + 2*(a + b*x + c*x**2)**p*b*e*f*p + (a + b*x + c*x**2 
)**p*b*e*g*p*x - (a + b*x + c*x**2)**p*b*e*g*x + 2*(a + b*x + c*x**2)**p*c 
*d*g*p*x + 2*int((a + b*x + c*x**2)**p/(a*b*d**2*e*p - a*b*d**2*e + 2*a*b* 
d*e**2*p*x - 2*a*b*d*e**2*x + a*b*e**3*p*x**2 - a*b*e**3*x**2 + 2*a*c*d**3 
*p + 4*a*c*d**2*e*p*x + 2*a*c*d*e**2*p*x**2 + b**2*d**2*e*p*x - b**2*d**2* 
e*x + 2*b**2*d*e**2*p*x**2 - 2*b**2*d*e**2*x**2 + b**2*e**3*p*x**3 - b**2* 
e**3*x**3 + 2*b*c*d**3*p*x + 5*b*c*d**2*e*p*x**2 - b*c*d**2*e*x**2 + 4*b*c 
*d*e**2*p*x**3 - 2*b*c*d*e**2*x**3 + b*c*e**3*p*x**4 - b*c*e**3*x**4 + 2*c 
**2*d**3*p*x**2 + 4*c**2*d**2*e*p*x**3 + 2*c**2*d*e**2*p*x**4),x)*a**2*b*d 
*e**3*g*p**2 - 2*int((a + b*x + c*x**2)**p/(a*b*d**2*e*p - a*b*d**2*e + 2* 
a*b*d*e**2*p*x - 2*a*b*d*e**2*x + a*b*e**3*p*x**2 - a*b*e**3*x**2 + 2*a*c* 
d**3*p + 4*a*c*d**2*e*p*x + 2*a*c*d*e**2*p*x**2 + b**2*d**2*e*p*x - b**2*d 
**2*e*x + 2*b**2*d*e**2*p*x**2 - 2*b**2*d*e**2*x**2 + b**2*e**3*p*x**3 - b 
**2*e**3*x**3 + 2*b*c*d**3*p*x + 5*b*c*d**2*e*p*x**2 - b*c*d**2*e*x**2 + 4 
*b*c*d*e**2*p*x**3 - 2*b*c*d*e**2*x**3 + b*c*e**3*p*x**4 - b*c*e**3*x**4 + 
 2*c**2*d**3*p*x**2 + 4*c**2*d**2*e*p*x**3 + 2*c**2*d*e**2*p*x**4),x)*a**2 
*b*d*e**3*g*p + 2*int((a + b*x + c*x**2)**p/(a*b*d**2*e*p - a*b*d**2*e + 2 
*a*b*d*e**2*p*x - 2*a*b*d*e**2*x + a*b*e**3*p*x**2 - a*b*e**3*x**2 + 2*a*c 
*d**3*p + 4*a*c*d**2*e*p*x + 2*a*c*d*e**2*p*x**2 + b**2*d**2*e*p*x - b*...