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

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

Optimal result

Integrand size = 29, antiderivative size = 218 \[ \int \frac {(a+b x)^2 (g+h x)}{(c+d x)^2 \sqrt {e+f x}} \, dx=\frac {2 b (2 a d f h+b (d f g-d e h-2 c f h)) \sqrt {e+f x}}{d^3 f^2}-\frac {(b c-a d)^2 (d g-c h) \sqrt {e+f x}}{d^3 (d e-c f) (c+d x)}+\frac {2 b^2 h (e+f x)^{3/2}}{3 d^2 f^2}-\frac {(b c-a d) \left (a d (d f g-2 d e h+c f h)-b \left (4 d^2 e g+5 c^2 f h-3 c d (f g+2 e h)\right )\right ) \text {arctanh}\left (\frac {\sqrt {d} \sqrt {e+f x}}{\sqrt {d e-c f}}\right )}{d^{7/2} (d e-c f)^{3/2}} \] Output:

2*b*(2*a*d*f*h+b*(-2*c*f*h-d*e*h+d*f*g))*(f*x+e)^(1/2)/d^3/f^2-(-a*d+b*c)^ 
2*(-c*h+d*g)*(f*x+e)^(1/2)/d^3/(-c*f+d*e)/(d*x+c)+2/3*b^2*h*(f*x+e)^(3/2)/ 
d^2/f^2-(-a*d+b*c)*(a*d*(c*f*h-2*d*e*h+d*f*g)-b*(4*d^2*e*g+5*c^2*f*h-3*c*d 
*(2*e*h+f*g)))*arctanh(d^(1/2)*(f*x+e)^(1/2)/(-c*f+d*e)^(1/2))/d^(7/2)/(-c 
*f+d*e)^(3/2)
 

Mathematica [A] (verified)

Time = 0.71 (sec) , antiderivative size = 286, normalized size of antiderivative = 1.31 \[ \int \frac {(a+b x)^2 (g+h x)}{(c+d x)^2 \sqrt {e+f x}} \, dx=-\frac {\sqrt {e+f x} \left (3 a^2 d^2 f^2 (d g-c h)-6 a b d f \left (-3 c^2 f h+2 d^2 e h x+c d (f g+2 e h-2 f h x)\right )+b^2 \left (-15 c^3 f^2 h+c^2 d f (9 f g+8 e h-10 f h x)-2 d^3 e x (3 f g-2 e h+f h x)+2 c d^2 \left (2 e^2 h-3 e f (g-h x)+f^2 x (3 g+h x)\right )\right )\right )}{3 d^3 f^2 (d e-c f) (c+d x)}+\frac {(b c-a d) \left (-a d (d f g-2 d e h+c f h)+b \left (4 d^2 e g+5 c^2 f h-3 c d (f g+2 e h)\right )\right ) \arctan \left (\frac {\sqrt {d} \sqrt {e+f x}}{\sqrt {-d e+c f}}\right )}{d^{7/2} (-d e+c f)^{3/2}} \] Input:

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

Output:

-1/3*(Sqrt[e + f*x]*(3*a^2*d^2*f^2*(d*g - c*h) - 6*a*b*d*f*(-3*c^2*f*h + 2 
*d^2*e*h*x + c*d*(f*g + 2*e*h - 2*f*h*x)) + b^2*(-15*c^3*f^2*h + c^2*d*f*( 
9*f*g + 8*e*h - 10*f*h*x) - 2*d^3*e*x*(3*f*g - 2*e*h + f*h*x) + 2*c*d^2*(2 
*e^2*h - 3*e*f*(g - h*x) + f^2*x*(3*g + h*x)))))/(d^3*f^2*(d*e - c*f)*(c + 
 d*x)) + ((b*c - a*d)*(-(a*d*(d*f*g - 2*d*e*h + c*f*h)) + b*(4*d^2*e*g + 5 
*c^2*f*h - 3*c*d*(f*g + 2*e*h)))*ArcTan[(Sqrt[d]*Sqrt[e + f*x])/Sqrt[-(d*e 
) + c*f]])/(d^(7/2)*(-(d*e) + c*f)^(3/2))
 

Rubi [A] (verified)

Time = 0.46 (sec) , antiderivative size = 271, normalized size of antiderivative = 1.24, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {166, 27, 164, 73, 221}

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

\(\Big \downarrow \) 166

\(\displaystyle \frac {\int \frac {(a+b x) ((4 b e+a f) (d g-c h)-2 a d (f g-e h)+b (3 d f g+2 d e h-5 c f h) x)}{2 (c+d x) \sqrt {e+f x}}dx}{d (d e-c f)}-\frac {(a+b x)^2 \sqrt {e+f x} (d g-c h)}{d (c+d x) (d e-c f)}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\int \frac {(a+b x) (4 b e (d g-c h)-a (d f g-2 d e h+c f h)+b (3 d f g+2 d e h-5 c f h) x)}{(c+d x) \sqrt {e+f x}}dx}{2 d (d e-c f)}-\frac {(a+b x)^2 \sqrt {e+f x} (d g-c h)}{d (c+d x) (d e-c f)}\)

\(\Big \downarrow \) 164

\(\displaystyle \frac {\frac {(b c-a d) \left (a d (c f h-2 d e h+d f g)-b \left (5 c^2 f h-3 c d (2 e h+f g)+4 d^2 e g\right )\right ) \int \frac {1}{(c+d x) \sqrt {e+f x}}dx}{d^2}+\frac {2 b \sqrt {e+f x} \left (6 a d f (-3 c f h+2 d e h+d f g)+b \left (15 c^2 f^2 h-c d f (8 e h+9 f g)+2 d^2 e (3 f g-2 e h)\right )+b d f x (-5 c f h+2 d e h+3 d f g)\right )}{3 d^2 f^2}}{2 d (d e-c f)}-\frac {(a+b x)^2 \sqrt {e+f x} (d g-c h)}{d (c+d x) (d e-c f)}\)

\(\Big \downarrow \) 73

\(\displaystyle \frac {\frac {2 (b c-a d) \left (a d (c f h-2 d e h+d f g)-b \left (5 c^2 f h-3 c d (2 e h+f g)+4 d^2 e g\right )\right ) \int \frac {1}{c+\frac {d (e+f x)}{f}-\frac {d e}{f}}d\sqrt {e+f x}}{d^2 f}+\frac {2 b \sqrt {e+f x} \left (6 a d f (-3 c f h+2 d e h+d f g)+b \left (15 c^2 f^2 h-c d f (8 e h+9 f g)+2 d^2 e (3 f g-2 e h)\right )+b d f x (-5 c f h+2 d e h+3 d f g)\right )}{3 d^2 f^2}}{2 d (d e-c f)}-\frac {(a+b x)^2 \sqrt {e+f x} (d g-c h)}{d (c+d x) (d e-c f)}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {2 b \sqrt {e+f x} \left (6 a d f (-3 c f h+2 d e h+d f g)+b \left (15 c^2 f^2 h-c d f (8 e h+9 f g)+2 d^2 e (3 f g-2 e h)\right )+b d f x (-5 c f h+2 d e h+3 d f g)\right )}{3 d^2 f^2}-\frac {2 (b c-a d) \text {arctanh}\left (\frac {\sqrt {d} \sqrt {e+f x}}{\sqrt {d e-c f}}\right ) \left (a d (c f h-2 d e h+d f g)-b \left (5 c^2 f h-3 c d (2 e h+f g)+4 d^2 e g\right )\right )}{d^{5/2} \sqrt {d e-c f}}}{2 d (d e-c f)}-\frac {(a+b x)^2 \sqrt {e+f x} (d g-c h)}{d (c+d x) (d e-c f)}\)

Input:

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

Output:

-(((d*g - c*h)*(a + b*x)^2*Sqrt[e + f*x])/(d*(d*e - c*f)*(c + d*x))) + ((2 
*b*Sqrt[e + f*x]*(6*a*d*f*(d*f*g + 2*d*e*h - 3*c*f*h) + b*(15*c^2*f^2*h + 
2*d^2*e*(3*f*g - 2*e*h) - c*d*f*(9*f*g + 8*e*h)) + b*d*f*(3*d*f*g + 2*d*e* 
h - 5*c*f*h)*x))/(3*d^2*f^2) - (2*(b*c - a*d)*(a*d*(d*f*g - 2*d*e*h + c*f* 
h) - b*(4*d^2*e*g + 5*c^2*f*h - 3*c*d*(f*g + 2*e*h)))*ArcTanh[(Sqrt[d]*Sqr 
t[e + f*x])/Sqrt[d*e - c*f]])/(d^(5/2)*Sqrt[d*e - c*f]))/(2*d*(d*e - c*f))
 

Defintions of rubi rules used

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 73
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[ 
{p = Denominator[m]}, Simp[p/b   Subst[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + 
 d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] && Lt 
Q[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntL 
inearQ[a, b, c, d, m, n, x]
 

rule 164
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_) + (f_.)*(x_ 
))*((g_.) + (h_.)*(x_)), x_] :> Simp[(-(a*d*f*h*(n + 2) + b*c*f*h*(m + 2) - 
 b*d*(f*g + e*h)*(m + n + 3) - b*d*f*h*(m + n + 2)*x))*(a + b*x)^(m + 1)*(( 
c + d*x)^(n + 1)/(b^2*d^2*(m + n + 2)*(m + n + 3))), x] + Simp[(a^2*d^2*f*h 
*(n + 1)*(n + 2) + a*b*d*(n + 1)*(2*c*f*h*(m + 1) - d*(f*g + e*h)*(m + n + 
3)) + b^2*(c^2*f*h*(m + 1)*(m + 2) - c*d*(f*g + e*h)*(m + 1)*(m + n + 3) + 
d^2*e*g*(m + n + 2)*(m + n + 3)))/(b^2*d^2*(m + n + 2)*(m + n + 3))   Int[( 
a + b*x)^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, h, m, n}, x] 
&& NeQ[m + n + 2, 0] && NeQ[m + n + 3, 0]
 

rule 166
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_)*((g_.) + (h_.)*(x_)), x_] :> Simp[(b*g - a*h)*(a + b*x)^(m + 1)*(c + 
 d*x)^n*((e + f*x)^(p + 1)/(b*(b*e - a*f)*(m + 1))), x] - Simp[1/(b*(b*e - 
a*f)*(m + 1))   Int[(a + b*x)^(m + 1)*(c + d*x)^(n - 1)*(e + f*x)^p*Simp[b* 
c*(f*g - e*h)*(m + 1) + (b*g - a*h)*(d*e*n + c*f*(p + 1)) + d*(b*(f*g - e*h 
)*(m + 1) + f*(b*g - a*h)*(n + p + 1))*x, x], x], x] /; FreeQ[{a, b, c, d, 
e, f, g, h, p}, x] && ILtQ[m, -1] && GtQ[n, 0]
 

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 
Maple [A] (verified)

Time = 0.53 (sec) , antiderivative size = 223, normalized size of antiderivative = 1.02

method result size
risch \(\frac {2 b \left (h b d f x +6 a d f h -6 b c f h -2 b d e h +3 b g d f \right ) \sqrt {f x +e}}{3 f^{2} d^{3}}+\frac {\left (2 a d -2 b c \right ) \left (-\frac {f \left (a c d h -a \,d^{2} g -b \,c^{2} h +b c d g \right ) \sqrt {f x +e}}{2 \left (c f -d e \right ) \left (\left (f x +e \right ) d +c f -d e \right )}+\frac {\left (a c d f h -2 a \,d^{2} e h +a \,d^{2} f g -5 b \,c^{2} f h +6 b c d e h +3 b c d f g -4 b \,d^{2} e g \right ) \arctan \left (\frac {d \sqrt {f x +e}}{\sqrt {\left (c f -d e \right ) d}}\right )}{2 \left (c f -d e \right ) \sqrt {\left (c f -d e \right ) d}}\right )}{d^{3}}\) \(223\)
pseudoelliptic \(-\frac {-\left (a d -b c \right ) \left (x d +c \right ) \left (\left (a f g -2 e \left (a h +2 b g \right )\right ) d^{2}+c \left (\left (a h +3 b g \right ) f +6 e h b \right ) d -5 b \,c^{2} f h \right ) f^{2} \arctan \left (\frac {d \sqrt {f x +e}}{\sqrt {\left (c f -d e \right ) d}}\right )+\left (\left (-a^{2} f^{2} g +4 x \left (\frac {\left (\frac {h x}{3}+g \right ) b}{2}+a h \right ) b e f -\frac {4 b^{2} e^{2} h x}{3}\right ) d^{3}+c \left (\left (2 \left (-\frac {1}{3} h \,x^{2}-g x \right ) b^{2}+2 a \left (-2 h x +g \right ) b +a^{2} h \right ) f^{2}+4 \left (\frac {\left (-h x +g \right ) b}{2}+a h \right ) b e f -\frac {4 b^{2} e^{2} h}{3}\right ) d^{2}-6 \left (\left (\left (-\frac {5 h x}{9}+\frac {g}{2}\right ) b +a h \right ) f +\frac {4 e h b}{9}\right ) c^{2} b f d +5 b^{2} c^{3} f^{2} h \right ) \sqrt {f x +e}\, \sqrt {\left (c f -d e \right ) d}}{\sqrt {\left (c f -d e \right ) d}\, f^{2} d^{3} \left (c f -d e \right ) \left (x d +c \right )}\) \(302\)
derivativedivides \(\frac {\frac {2 b \left (\frac {d h \left (f x +e \right )^{\frac {3}{2}} b}{3}+2 a d f h \sqrt {f x +e}-2 b c f h \sqrt {f x +e}-b d e h \sqrt {f x +e}+b d f g \sqrt {f x +e}\right )}{d^{3}}-\frac {2 f^{2} \left (\frac {f \left (a^{2} c \,d^{2} h -a^{2} d^{3} g -2 a b \,c^{2} d h +2 a b c \,d^{2} g +c^{3} h \,b^{2}-b^{2} c^{2} d g \right ) \sqrt {f x +e}}{2 \left (c f -d e \right ) \left (\left (f x +e \right ) d +c f -d e \right )}-\frac {\left (a^{2} c \,d^{2} f h -2 a^{2} d^{3} e h +a^{2} d^{3} f g -6 a b \,c^{2} d f h +8 a b c \,d^{2} e h +2 a b c \,d^{2} f g -4 a b \,d^{3} e g +5 b^{2} c^{3} f h -6 b^{2} c^{2} d e h -3 b^{2} c^{2} d f g +4 b^{2} c \,d^{2} e g \right ) \arctan \left (\frac {d \sqrt {f x +e}}{\sqrt {\left (c f -d e \right ) d}}\right )}{2 \left (c f -d e \right ) \sqrt {\left (c f -d e \right ) d}}\right )}{d^{3}}}{f^{2}}\) \(335\)
default \(\frac {\frac {2 b \left (\frac {d h \left (f x +e \right )^{\frac {3}{2}} b}{3}+2 a d f h \sqrt {f x +e}-2 b c f h \sqrt {f x +e}-b d e h \sqrt {f x +e}+b d f g \sqrt {f x +e}\right )}{d^{3}}-\frac {2 f^{2} \left (\frac {f \left (a^{2} c \,d^{2} h -a^{2} d^{3} g -2 a b \,c^{2} d h +2 a b c \,d^{2} g +c^{3} h \,b^{2}-b^{2} c^{2} d g \right ) \sqrt {f x +e}}{2 \left (c f -d e \right ) \left (\left (f x +e \right ) d +c f -d e \right )}-\frac {\left (a^{2} c \,d^{2} f h -2 a^{2} d^{3} e h +a^{2} d^{3} f g -6 a b \,c^{2} d f h +8 a b c \,d^{2} e h +2 a b c \,d^{2} f g -4 a b \,d^{3} e g +5 b^{2} c^{3} f h -6 b^{2} c^{2} d e h -3 b^{2} c^{2} d f g +4 b^{2} c \,d^{2} e g \right ) \arctan \left (\frac {d \sqrt {f x +e}}{\sqrt {\left (c f -d e \right ) d}}\right )}{2 \left (c f -d e \right ) \sqrt {\left (c f -d e \right ) d}}\right )}{d^{3}}}{f^{2}}\) \(335\)

Input:

int((b*x+a)^2*(h*x+g)/(d*x+c)^2/(f*x+e)^(1/2),x,method=_RETURNVERBOSE)
 

Output:

2/3*b*(b*d*f*h*x+6*a*d*f*h-6*b*c*f*h-2*b*d*e*h+3*b*d*f*g)*(f*x+e)^(1/2)/f^ 
2/d^3+1/d^3*(2*a*d-2*b*c)*(-1/2*f*(a*c*d*h-a*d^2*g-b*c^2*h+b*c*d*g)/(c*f-d 
*e)*(f*x+e)^(1/2)/((f*x+e)*d+c*f-d*e)+1/2*(a*c*d*f*h-2*a*d^2*e*h+a*d^2*f*g 
-5*b*c^2*f*h+6*b*c*d*e*h+3*b*c*d*f*g-4*b*d^2*e*g)/(c*f-d*e)/((c*f-d*e)*d)^ 
(1/2)*arctan(d*(f*x+e)^(1/2)/((c*f-d*e)*d)^(1/2)))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 767 vs. \(2 (200) = 400\).

Time = 0.13 (sec) , antiderivative size = 1547, normalized size of antiderivative = 7.10 \[ \int \frac {(a+b x)^2 (g+h x)}{(c+d x)^2 \sqrt {e+f x}} \, dx=\text {Too large to display} \] Input:

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

Output:

[-1/6*(3*sqrt(d^2*e - c*d*f)*((4*(b^2*c^2*d^2 - a*b*c*d^3)*e*f^2 - (3*b^2* 
c^3*d - 2*a*b*c^2*d^2 - a^2*c*d^3)*f^3)*g - (2*(3*b^2*c^3*d - 4*a*b*c^2*d^ 
2 + a^2*c*d^3)*e*f^2 - (5*b^2*c^4 - 6*a*b*c^3*d + a^2*c^2*d^2)*f^3)*h + (( 
4*(b^2*c*d^3 - a*b*d^4)*e*f^2 - (3*b^2*c^2*d^2 - 2*a*b*c*d^3 - a^2*d^4)*f^ 
3)*g - (2*(3*b^2*c^2*d^2 - 4*a*b*c*d^3 + a^2*d^4)*e*f^2 - (5*b^2*c^3*d - 6 
*a*b*c^2*d^2 + a^2*c*d^3)*f^3)*h)*x)*log((d*f*x + 2*d*e - c*f - 2*sqrt(d^2 
*e - c*d*f)*sqrt(f*x + e))/(d*x + c)) - 2*(2*(b^2*d^5*e^2*f - 2*b^2*c*d^4* 
e*f^2 + b^2*c^2*d^3*f^3)*h*x^2 + 3*(2*b^2*c*d^4*e^2*f - (5*b^2*c^2*d^3 - 2 
*a*b*c*d^4 + a^2*d^5)*e*f^2 + (3*b^2*c^3*d^2 - 2*a*b*c^2*d^3 + a^2*c*d^4)* 
f^3)*g - (4*b^2*c*d^4*e^3 + 4*(b^2*c^2*d^3 - 3*a*b*c*d^4)*e^2*f - (23*b^2* 
c^3*d^2 - 30*a*b*c^2*d^3 + 3*a^2*c*d^4)*e*f^2 + 3*(5*b^2*c^4*d - 6*a*b*c^3 
*d^2 + a^2*c^2*d^3)*f^3)*h + 2*(3*(b^2*d^5*e^2*f - 2*b^2*c*d^4*e*f^2 + b^2 
*c^2*d^3*f^3)*g - (2*b^2*d^5*e^3 + (b^2*c*d^4 - 6*a*b*d^5)*e^2*f - 4*(2*b^ 
2*c^2*d^3 - 3*a*b*c*d^4)*e*f^2 + (5*b^2*c^3*d^2 - 6*a*b*c^2*d^3)*f^3)*h)*x 
)*sqrt(f*x + e))/(c*d^6*e^2*f^2 - 2*c^2*d^5*e*f^3 + c^3*d^4*f^4 + (d^7*e^2 
*f^2 - 2*c*d^6*e*f^3 + c^2*d^5*f^4)*x), -1/3*(3*sqrt(-d^2*e + c*d*f)*((4*( 
b^2*c^2*d^2 - a*b*c*d^3)*e*f^2 - (3*b^2*c^3*d - 2*a*b*c^2*d^2 - a^2*c*d^3) 
*f^3)*g - (2*(3*b^2*c^3*d - 4*a*b*c^2*d^2 + a^2*c*d^3)*e*f^2 - (5*b^2*c^4 
- 6*a*b*c^3*d + a^2*c^2*d^2)*f^3)*h + ((4*(b^2*c*d^3 - a*b*d^4)*e*f^2 - (3 
*b^2*c^2*d^2 - 2*a*b*c*d^3 - a^2*d^4)*f^3)*g - (2*(3*b^2*c^2*d^2 - 4*a*...
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F(-2)]

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

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

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(c*f-d*e>0)', see `assume?` for m 
ore detail
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 407 vs. \(2 (200) = 400\).

Time = 0.13 (sec) , antiderivative size = 407, normalized size of antiderivative = 1.87 \[ \int \frac {(a+b x)^2 (g+h x)}{(c+d x)^2 \sqrt {e+f x}} \, dx=-\frac {{\left (4 \, b^{2} c d^{2} e g - 4 \, a b d^{3} e g - 3 \, b^{2} c^{2} d f g + 2 \, a b c d^{2} f g + a^{2} d^{3} f g - 6 \, b^{2} c^{2} d e h + 8 \, a b c d^{2} e h - 2 \, a^{2} d^{3} e h + 5 \, b^{2} c^{3} f h - 6 \, a b c^{2} d f h + a^{2} c d^{2} f h\right )} \arctan \left (\frac {\sqrt {f x + e} d}{\sqrt {-d^{2} e + c d f}}\right )}{{\left (d^{4} e - c d^{3} f\right )} \sqrt {-d^{2} e + c d f}} - \frac {\sqrt {f x + e} b^{2} c^{2} d f g - 2 \, \sqrt {f x + e} a b c d^{2} f g + \sqrt {f x + e} a^{2} d^{3} f g - \sqrt {f x + e} b^{2} c^{3} f h + 2 \, \sqrt {f x + e} a b c^{2} d f h - \sqrt {f x + e} a^{2} c d^{2} f h}{{\left (d^{4} e - c d^{3} f\right )} {\left ({\left (f x + e\right )} d - d e + c f\right )}} + \frac {2 \, {\left (3 \, \sqrt {f x + e} b^{2} d^{4} f^{5} g + {\left (f x + e\right )}^{\frac {3}{2}} b^{2} d^{4} f^{4} h - 3 \, \sqrt {f x + e} b^{2} d^{4} e f^{4} h - 6 \, \sqrt {f x + e} b^{2} c d^{3} f^{5} h + 6 \, \sqrt {f x + e} a b d^{4} f^{5} h\right )}}{3 \, d^{6} f^{6}} \] Input:

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

Output:

-(4*b^2*c*d^2*e*g - 4*a*b*d^3*e*g - 3*b^2*c^2*d*f*g + 2*a*b*c*d^2*f*g + a^ 
2*d^3*f*g - 6*b^2*c^2*d*e*h + 8*a*b*c*d^2*e*h - 2*a^2*d^3*e*h + 5*b^2*c^3* 
f*h - 6*a*b*c^2*d*f*h + a^2*c*d^2*f*h)*arctan(sqrt(f*x + e)*d/sqrt(-d^2*e 
+ c*d*f))/((d^4*e - c*d^3*f)*sqrt(-d^2*e + c*d*f)) - (sqrt(f*x + e)*b^2*c^ 
2*d*f*g - 2*sqrt(f*x + e)*a*b*c*d^2*f*g + sqrt(f*x + e)*a^2*d^3*f*g - sqrt 
(f*x + e)*b^2*c^3*f*h + 2*sqrt(f*x + e)*a*b*c^2*d*f*h - sqrt(f*x + e)*a^2* 
c*d^2*f*h)/((d^4*e - c*d^3*f)*((f*x + e)*d - d*e + c*f)) + 2/3*(3*sqrt(f*x 
 + e)*b^2*d^4*f^5*g + (f*x + e)^(3/2)*b^2*d^4*f^4*h - 3*sqrt(f*x + e)*b^2* 
d^4*e*f^4*h - 6*sqrt(f*x + e)*b^2*c*d^3*f^5*h + 6*sqrt(f*x + e)*a*b*d^4*f^ 
5*h)/(d^6*f^6)
 

Mupad [B] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 450, normalized size of antiderivative = 2.06 \[ \int \frac {(a+b x)^2 (g+h x)}{(c+d x)^2 \sqrt {e+f x}} \, dx=\sqrt {e+f\,x}\,\left (\frac {2\,b^2\,f\,g-6\,b^2\,e\,h+4\,a\,b\,f\,h}{d^2\,f^2}-\frac {4\,b^2\,h\,\left (c\,f-d\,e\right )}{d^3\,f^2}\right )+\frac {\sqrt {e+f\,x}\,\left (-f\,h\,a^2\,c\,d^2+f\,g\,a^2\,d^3+2\,f\,h\,a\,b\,c^2\,d-2\,f\,g\,a\,b\,c\,d^2-f\,h\,b^2\,c^3+f\,g\,b^2\,c^2\,d\right )}{\left (c\,f-d\,e\right )\,\left (d^4\,\left (e+f\,x\right )-d^4\,e+c\,d^3\,f\right )}+\frac {2\,b^2\,h\,{\left (e+f\,x\right )}^{3/2}}{3\,d^2\,f^2}+\frac {\mathrm {atan}\left (\frac {\sqrt {d}\,\sqrt {e+f\,x}\,\left (a\,d-b\,c\right )\,\left (a\,d^2\,f\,g-2\,a\,d^2\,e\,h-4\,b\,d^2\,e\,g-5\,b\,c^2\,f\,h+a\,c\,d\,f\,h+6\,b\,c\,d\,e\,h+3\,b\,c\,d\,f\,g\right )}{\sqrt {c\,f-d\,e}\,\left (a^2\,d^3\,f\,g-2\,a^2\,d^3\,e\,h+5\,b^2\,c^3\,f\,h+4\,b^2\,c\,d^2\,e\,g+a^2\,c\,d^2\,f\,h-6\,b^2\,c^2\,d\,e\,h-3\,b^2\,c^2\,d\,f\,g-4\,a\,b\,d^3\,e\,g+8\,a\,b\,c\,d^2\,e\,h+2\,a\,b\,c\,d^2\,f\,g-6\,a\,b\,c^2\,d\,f\,h\right )}\right )\,\left (a\,d-b\,c\right )\,\left (a\,d^2\,f\,g-2\,a\,d^2\,e\,h-4\,b\,d^2\,e\,g-5\,b\,c^2\,f\,h+a\,c\,d\,f\,h+6\,b\,c\,d\,e\,h+3\,b\,c\,d\,f\,g\right )}{d^{7/2}\,{\left (c\,f-d\,e\right )}^{3/2}} \] Input:

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

Output:

(e + f*x)^(1/2)*((2*b^2*f*g - 6*b^2*e*h + 4*a*b*f*h)/(d^2*f^2) - (4*b^2*h* 
(c*f - d*e))/(d^3*f^2)) + ((e + f*x)^(1/2)*(a^2*d^3*f*g - b^2*c^3*f*h - a^ 
2*c*d^2*f*h + b^2*c^2*d*f*g - 2*a*b*c*d^2*f*g + 2*a*b*c^2*d*f*h))/((c*f - 
d*e)*(d^4*(e + f*x) - d^4*e + c*d^3*f)) + (2*b^2*h*(e + f*x)^(3/2))/(3*d^2 
*f^2) + (atan((d^(1/2)*(e + f*x)^(1/2)*(a*d - b*c)*(a*d^2*f*g - 2*a*d^2*e* 
h - 4*b*d^2*e*g - 5*b*c^2*f*h + a*c*d*f*h + 6*b*c*d*e*h + 3*b*c*d*f*g))/(( 
c*f - d*e)^(1/2)*(a^2*d^3*f*g - 2*a^2*d^3*e*h + 5*b^2*c^3*f*h + 4*b^2*c*d^ 
2*e*g + a^2*c*d^2*f*h - 6*b^2*c^2*d*e*h - 3*b^2*c^2*d*f*g - 4*a*b*d^3*e*g 
+ 8*a*b*c*d^2*e*h + 2*a*b*c*d^2*f*g - 6*a*b*c^2*d*f*h)))*(a*d - b*c)*(a*d^ 
2*f*g - 2*a*d^2*e*h - 4*b*d^2*e*g - 5*b*c^2*f*h + a*c*d*f*h + 6*b*c*d*e*h 
+ 3*b*c*d*f*g))/(d^(7/2)*(c*f - d*e)^(3/2))
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 1740, normalized size of antiderivative = 7.98 \[ \int \frac {(a+b x)^2 (g+h x)}{(c+d x)^2 \sqrt {e+f x}} \, dx =\text {Too large to display} \] Input:

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

Output:

(3*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e) 
))*a**2*c**2*d**2*f**3*h - 6*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d 
)/(sqrt(d)*sqrt(c*f - d*e)))*a**2*c*d**3*e*f**2*h + 3*sqrt(d)*sqrt(c*f - d 
*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*a**2*c*d**3*f**3*g + 
 3*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e) 
))*a**2*c*d**3*f**3*h*x - 6*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d) 
/(sqrt(d)*sqrt(c*f - d*e)))*a**2*d**4*e*f**2*h*x + 3*sqrt(d)*sqrt(c*f - d* 
e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*a**2*d**4*f**3*g*x - 
18*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e) 
))*a*b*c**3*d*f**3*h + 24*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d)/( 
sqrt(d)*sqrt(c*f - d*e)))*a*b*c**2*d**2*e*f**2*h + 6*sqrt(d)*sqrt(c*f - d* 
e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*a*b*c**2*d**2*f**3*g 
- 18*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d* 
e)))*a*b*c**2*d**2*f**3*h*x - 12*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f* 
x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*a*b*c*d**3*e*f**2*g + 24*sqrt(d)*sqrt(c*f 
 - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*a*b*c*d**3*e*f** 
2*h*x + 6*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f 
 - d*e)))*a*b*c*d**3*f**3*g*x - 12*sqrt(d)*sqrt(c*f - d*e)*atan((sqrt(e + 
f*x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*a*b*d**4*e*f**2*g*x + 15*sqrt(d)*sqrt(c 
*f - d*e)*atan((sqrt(e + f*x)*d)/(sqrt(d)*sqrt(c*f - d*e)))*b**2*c**4*f...