### 3.191 $$\int \frac{\sqrt{a+b x+c x^2} (d+e x+f x^2)}{(g+h x)^2} \, dx$$

Optimal. Leaf size=459 $-\frac{\tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+b x+c x^2}}\right ) \left (4 c h (-a f h-b e h+2 b f g)+b^2 f h^2-8 c^2 \left (3 f g^2-h (2 e g-d h)\right )\right )}{8 c^{3/2} h^4}-\frac{\sqrt{a+b x+c x^2} \left (2 c h^2 x \left (-a f h+b f g-2 c d h+2 c e g-\frac{3 c f g^2}{h}\right )+c h \left (4 a h (2 f g-e h)-b \left (4 d h^2-8 e g h+13 f g^2\right )\right )+b f h^2 (b g-a h)+4 c^2 g \left (3 f g^2-h (2 e g-d h)\right )\right )}{4 c h^3 \left (a h^2-b g h+c g^2\right )}-\frac{\left (a+b x+c x^2\right )^{3/2} \left (f g^2-h (e g-d h)\right )}{h (g+h x) \left (a h^2-b g h+c g^2\right )}-\frac{\tanh ^{-1}\left (\frac{-2 a h+x (2 c g-b h)+b g}{2 \sqrt{a+b x+c x^2} \sqrt{a h^2-b g h+c g^2}}\right ) \left (h \left (2 a h (2 f g-e h)-b \left (d h^2-3 e g h+5 f g^2\right )\right )+2 c g \left (3 f g^2-h (2 e g-d h)\right )\right )}{2 h^4 \sqrt{a h^2-b g h+c g^2}}$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 1.10023, antiderivative size = 453, normalized size of antiderivative = 0.99, number of steps used = 7, number of rules used = 6, integrand size = 32, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.188, Rules used = {1650, 814, 843, 621, 206, 724} $-\frac{\tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+b x+c x^2}}\right ) \left (4 c h (-a f h-b e h+2 b f g)+b^2 f h^2-8 c^2 \left (3 f g^2-h (2 e g-d h)\right )\right )}{8 c^{3/2} h^4}-\frac{\sqrt{a+b x+c x^2} \left (2 c h x \left (-a f h+b f g-2 c d h+2 c e g-\frac{3 c f g^2}{h}\right )+b f h (b g-a h)+4 a c h (2 f g-e h)-b c \left (4 d h^2-8 e g h+13 f g^2\right )-4 c^2 g \left (-d h+2 e g-\frac{3 f g^2}{h}\right )\right )}{4 c h^2 \left (a h^2-b g h+c g^2\right )}-\frac{\left (a+b x+c x^2\right )^{3/2} \left (f g^2-h (e g-d h)\right )}{h (g+h x) \left (a h^2-b g h+c g^2\right )}-\frac{\tanh ^{-1}\left (\frac{-2 a h+x (2 c g-b h)+b g}{2 \sqrt{a+b x+c x^2} \sqrt{a h^2-b g h+c g^2}}\right ) \left (2 c \left (3 f g^3-g h (2 e g-d h)\right )-h \left (-2 a h (2 f g-e h)-b h (3 e g-d h)+5 b f g^2\right )\right )}{2 h^4 \sqrt{a h^2-b g h+c g^2}}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

-((b*f*h*(b*g - a*h) - 4*c^2*g*(2*e*g - (3*f*g^2)/h - d*h) + 4*a*c*h*(2*f*g - e*h) - b*c*(13*f*g^2 - 8*e*g*h +
4*d*h^2) + 2*c*h*(2*c*e*g + b*f*g - (3*c*f*g^2)/h - 2*c*d*h - a*f*h)*x)*Sqrt[a + b*x + c*x^2])/(4*c*h^2*(c*g^
2 - b*g*h + a*h^2)) - ((f*g^2 - h*(e*g - d*h))*(a + b*x + c*x^2)^(3/2))/(h*(c*g^2 - b*g*h + a*h^2)*(g + h*x))
- ((b^2*f*h^2 + 4*c*h*(2*b*f*g - b*e*h - a*f*h) - 8*c^2*(3*f*g^2 - h*(2*e*g - d*h)))*ArcTanh[(b + 2*c*x)/(2*Sq
rt[c]*Sqrt[a + b*x + c*x^2])])/(8*c^(3/2)*h^4) - ((2*c*(3*f*g^3 - g*h*(2*e*g - d*h)) - h*(5*b*f*g^2 - b*h*(3*e
*g - d*h) - 2*a*h*(2*f*g - e*h)))*ArcTanh[(b*g - 2*a*h + (2*c*g - b*h)*x)/(2*Sqrt[c*g^2 - b*g*h + a*h^2]*Sqrt[
a + b*x + c*x^2])])/(2*h^4*Sqrt[c*g^2 - b*g*h + a*h^2])

Rule 1650

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = Polynomia
lQuotient[Pq, d + e*x, x], R = PolynomialRemainder[Pq, d + e*x, x]}, Simp[(e*R*(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] + Dist[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*ExpandToSum[(m + 1)*(c*d^2 - b*d*e + a*e^2)*Q + c*d*R*(m + 1) - b*e*R*(m + p + 2)
- c*e*R*(m + 2*p + 3)*x, x], x], x]] /; FreeQ[{a, b, c, d, e, p}, x] && PolyQ[Pq, x] && NeQ[b^2 - 4*a*c, 0] &&
NeQ[c*d^2 - b*d*e + a*e^2, 0] && LtQ[m, -1]

Rule 814

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Sim
p[((d + e*x)^(m + 1)*(c*e*f*(m + 2*p + 2) - g*(c*d + 2*c*d*p - b*e*p) + g*c*e*(m + 2*p + 1)*x)*(a + b*x + c*x^
2)^p)/(c*e^2*(m + 2*p + 1)*(m + 2*p + 2)), x] - Dist[p/(c*e^2*(m + 2*p + 1)*(m + 2*p + 2)), Int[(d + e*x)^m*(a
+ b*x + c*x^2)^(p - 1)*Simp[c*e*f*(b*d - 2*a*e)*(m + 2*p + 2) + g*(a*e*(b*e - 2*c*d*m + b*e*m) + b*d*(b*e*p -
c*d - 2*c*d*p)) + (c*e*f*(2*c*d - b*e)*(m + 2*p + 2) + g*(b^2*e^2*(p + m + 1) - 2*c^2*d^2*(1 + 2*p) - c*e*(b*
d*(m - 2*p) + 2*a*e*(m + 2*p + 1))))*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, g, m}, x] && NeQ[b^2 - 4*a*c, 0
] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && GtQ[p, 0] && (IntegerQ[p] ||  !RationalQ[m] || (GeQ[m, -1] && LtQ[m, 0])
) &&  !ILtQ[m + 2*p, 0] && (IntegerQ[m] || IntegerQ[p] || IntegersQ[2*m, 2*p])

Rule 843

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Dis
t[g/e, Int[(d + e*x)^(m + 1)*(a + b*x + c*x^2)^p, x], x] + Dist[(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] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0]
&&  !IGtQ[m, 0]

Rule 621

Int[1/Sqrt[(a_) + (b_.)*(x_) + (c_.)*(x_)^2], x_Symbol] :> Dist[2, Subst[Int[1/(4*c - x^2), x], x, (b + 2*c*x)
/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
/; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 724

Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]), x_Symbol] :> Dist[-2, Subst[Int[1/(4*c*d
^2 - 4*b*d*e + 4*a*e^2 - x^2), x], x, (2*a*e - b*d - (2*c*d - b*e)*x)/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a,
b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[2*c*d - b*e, 0]

Rubi steps

\begin{align*} \int \frac{\sqrt{a+b x+c x^2} \left (d+e x+f x^2\right )}{(g+h x)^2} \, dx &=-\frac{\left (f g^2-h (e g-d h)\right ) \left (a+b x+c x^2\right )^{3/2}}{h \left (c g^2-b g h+a h^2\right ) (g+h x)}-\frac{\int \frac{\left (\frac{1}{2} \left (-2 c d g+3 b e g+2 a f g-\frac{3 b f g^2}{h}-b d h-2 a e h\right )+\left (2 c e g+b f g-\frac{3 c f g^2}{h}-2 c d h-a f h\right ) x\right ) \sqrt{a+b x+c x^2}}{g+h x} \, dx}{c g^2-b g h+a h^2}\\ &=-\frac{\left (b f h (b g-a h)-4 c^2 g \left (2 e g-\frac{3 f g^2}{h}-d h\right )+4 a c h (2 f g-e h)-b c \left (13 f g^2-8 e g h+4 d h^2\right )+2 c h \left (2 c e g+b f g-\frac{3 c f g^2}{h}-2 c d h-a f h\right ) x\right ) \sqrt{a+b x+c x^2}}{4 c h^2 \left (c g^2-b g h+a h^2\right )}-\frac{\left (f g^2-h (e g-d h)\right ) \left (a+b x+c x^2\right )^{3/2}}{h \left (c g^2-b g h+a h^2\right ) (g+h x)}+\frac{\int \frac{-\frac{\left (c g^2-b g h+a h^2\right ) \left (b^2 f g h+4 a c h (3 f g-2 e h)-4 b c \left (3 f g^2-h (2 e g-d h)\right )\right )}{2 h}-\frac{\left (c g^2-b g h+a h^2\right ) \left (b^2 f h^2+4 c h (2 b f g-b e h-a f h)-8 c^2 \left (3 f g^2-h (2 e g-d h)\right )\right ) x}{2 h}}{(g+h x) \sqrt{a+b x+c x^2}} \, dx}{4 c h^2 \left (c g^2-b g h+a h^2\right )}\\ &=-\frac{\left (b f h (b g-a h)-4 c^2 g \left (2 e g-\frac{3 f g^2}{h}-d h\right )+4 a c h (2 f g-e h)-b c \left (13 f g^2-8 e g h+4 d h^2\right )+2 c h \left (2 c e g+b f g-\frac{3 c f g^2}{h}-2 c d h-a f h\right ) x\right ) \sqrt{a+b x+c x^2}}{4 c h^2 \left (c g^2-b g h+a h^2\right )}-\frac{\left (f g^2-h (e g-d h)\right ) \left (a+b x+c x^2\right )^{3/2}}{h \left (c g^2-b g h+a h^2\right ) (g+h x)}-\frac{\left (b^2 f h^2+4 c h (2 b f g-b e h-a f h)-8 c^2 \left (3 f g^2-h (2 e g-d h)\right )\right ) \int \frac{1}{\sqrt{a+b x+c x^2}} \, dx}{8 c h^4}-\frac{\left (2 c \left (3 f g^3-g h (2 e g-d h)\right )-h \left (5 b f g^2-b h (3 e g-d h)-2 a h (2 f g-e h)\right )\right ) \int \frac{1}{(g+h x) \sqrt{a+b x+c x^2}} \, dx}{2 h^4}\\ &=-\frac{\left (b f h (b g-a h)-4 c^2 g \left (2 e g-\frac{3 f g^2}{h}-d h\right )+4 a c h (2 f g-e h)-b c \left (13 f g^2-8 e g h+4 d h^2\right )+2 c h \left (2 c e g+b f g-\frac{3 c f g^2}{h}-2 c d h-a f h\right ) x\right ) \sqrt{a+b x+c x^2}}{4 c h^2 \left (c g^2-b g h+a h^2\right )}-\frac{\left (f g^2-h (e g-d h)\right ) \left (a+b x+c x^2\right )^{3/2}}{h \left (c g^2-b g h+a h^2\right ) (g+h x)}-\frac{\left (b^2 f h^2+4 c h (2 b f g-b e h-a f h)-8 c^2 \left (3 f g^2-h (2 e g-d h)\right )\right ) \operatorname{Subst}\left (\int \frac{1}{4 c-x^2} \, dx,x,\frac{b+2 c x}{\sqrt{a+b x+c x^2}}\right )}{4 c h^4}+\frac{\left (2 c \left (3 f g^3-g h (2 e g-d h)\right )-h \left (5 b f g^2-b h (3 e g-d h)-2 a h (2 f g-e h)\right )\right ) \operatorname{Subst}\left (\int \frac{1}{4 c g^2-4 b g h+4 a h^2-x^2} \, dx,x,\frac{-b g+2 a h-(2 c g-b h) x}{\sqrt{a+b x+c x^2}}\right )}{h^4}\\ &=-\frac{\left (b f h (b g-a h)-4 c^2 g \left (2 e g-\frac{3 f g^2}{h}-d h\right )+4 a c h (2 f g-e h)-b c \left (13 f g^2-8 e g h+4 d h^2\right )+2 c h \left (2 c e g+b f g-\frac{3 c f g^2}{h}-2 c d h-a f h\right ) x\right ) \sqrt{a+b x+c x^2}}{4 c h^2 \left (c g^2-b g h+a h^2\right )}-\frac{\left (f g^2-h (e g-d h)\right ) \left (a+b x+c x^2\right )^{3/2}}{h \left (c g^2-b g h+a h^2\right ) (g+h x)}-\frac{\left (b^2 f h^2+4 c h (2 b f g-b e h-a f h)-8 c^2 \left (3 f g^2-h (2 e g-d h)\right )\right ) \tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+b x+c x^2}}\right )}{8 c^{3/2} h^4}-\frac{\left (2 c \left (3 f g^3-g h (2 e g-d h)\right )-h \left (5 b f g^2-b h (3 e g-d h)-2 a h (2 f g-e h)\right )\right ) \tanh ^{-1}\left (\frac{b g-2 a h+(2 c g-b h) x}{2 \sqrt{c g^2-b g h+a h^2} \sqrt{a+b x+c x^2}}\right )}{2 h^4 \sqrt{c g^2-b g h+a h^2}}\\ \end{align*}

Mathematica [A]  time = 1.69481, size = 486, normalized size = 1.06 $\frac{-\frac{\frac{\left (h (a h-b g)+c g^2\right ) \tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+x (b+c x)}}\right ) \left (4 c h (a f h+b e h-2 b f g)-b^2 f h^2+8 c^2 \left (h (d h-2 e g)+3 f g^2\right )\right )}{\sqrt{c}}+2 h \sqrt{a+x (b+c x)} \left (c h (2 a h (2 e h-4 f g+f h x)+4 b h (d h-2 e g)+b f g (13 g-2 h x))+b f h^2 (a h-b g)+c^2 \left (4 h (d h (h x-g)+e g (2 g-h x))+6 f g^2 (h x-2 g)\right )\right )+4 c \sqrt{h (a h-b g)+c g^2} \tanh ^{-1}\left (\frac{2 a h-b g+b h x-2 c g x}{2 \sqrt{a+x (b+c x)} \sqrt{h (a h-b g)+c g^2}}\right ) \left (2 c \left (g h (d h-2 e g)+3 f g^3\right )-h \left (2 a h (e h-2 f g)+b h (d h-3 e g)+5 b f g^2\right )\right )}{4 h^3 \left (h (b g-a h)-c g^2\right )}-\frac{(a+x (b+c x))^{3/2} \left (f h (a h-b g)+2 c h (d h-e g)+3 c f g^2\right )}{(g+h x) \left (h (a h-b g)+c g^2\right )}+\frac{f (a+x (b+c x))^{3/2}}{g+h x}}{2 c h}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B]  time = 0.273, size = 6218, normalized size = 13.6 \begin{align*} \text{output too large to display} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

result too large to display

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Timed out

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Timed out

________________________________________________________________________________________

Giac [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: TypeError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: TypeError