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

Optimal. Leaf size=223 $\frac{\sqrt{a+b x+c x^2} \left (-2 c h (8 a f h+9 b (e h+f g))+15 b^2 f h^2-2 c h x (5 b f h-6 c e h+2 c f g)-8 c^2 \left (f g^2-3 h (d h+e g)\right )\right )}{24 c^3 h}+\frac{\tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+b x+c x^2}}\right ) \left (-8 c^2 (a e h+a f g+b d h+b e g)+6 b c (2 a f h+b e h+b f g)-5 b^3 f h+16 c^3 d g\right )}{16 c^{7/2}}+\frac{f (g+h x)^2 \sqrt{a+b x+c x^2}}{3 c h}$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.303192, antiderivative size = 223, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 30, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.133, Rules used = {1653, 779, 621, 206} $\frac{\sqrt{a+b x+c x^2} \left (-2 c h (8 a f h+9 b (e h+f g))+15 b^2 f h^2-2 c h x (5 b f h-6 c e h+2 c f g)-8 c^2 \left (f g^2-3 h (d h+e g)\right )\right )}{24 c^3 h}+\frac{\tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+b x+c x^2}}\right ) \left (-8 c^2 (a e h+a f g+b d h+b e g)+6 b c (2 a f h+b e h+b f g)-5 b^3 f h+16 c^3 d g\right )}{16 c^{7/2}}+\frac{f (g+h x)^2 \sqrt{a+b x+c x^2}}{3 c h}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 1653

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{q = Expon[Pq
, x], f = Coeff[Pq, x, Expon[Pq, x]]}, Simp[(f*(d + e*x)^(m + q - 1)*(a + b*x + c*x^2)^(p + 1))/(c*e^(q - 1)*(
m + q + 2*p + 1)), x] + Dist[1/(c*e^q*(m + q + 2*p + 1)), Int[(d + e*x)^m*(a + b*x + c*x^2)^p*ExpandToSum[c*e^
q*(m + q + 2*p + 1)*Pq - c*f*(m + q + 2*p + 1)*(d + e*x)^q - f*(d + e*x)^(q - 2)*(b*d*e*(p + 1) + a*e^2*(m + q
- 1) - c*d^2*(m + q + 2*p + 1) - e*(2*c*d - b*e)*(m + q + p)*x), x], x], x] /; GtQ[q, 1] && NeQ[m + q + 2*p +
1, 0]] /; FreeQ[{a, b, c, d, e, m, p}, x] && PolyQ[Pq, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2
, 0] &&  !(IGtQ[m, 0] && RationalQ[a, b, c, d, e] && (IntegerQ[p] || ILtQ[p + 1/2, 0]))

Rule 779

Int[((d_.) + (e_.)*(x_))*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> -Simp[((b
*e*g*(p + 2) - c*(e*f + d*g)*(2*p + 3) - 2*c*e*g*(p + 1)*x)*(a + b*x + c*x^2)^(p + 1))/(2*c^2*(p + 1)*(2*p + 3
)), x] + Dist[(b^2*e*g*(p + 2) - 2*a*c*e*g + c*(2*c*d*f - b*(e*f + d*g))*(2*p + 3))/(2*c^2*(2*p + 3)), Int[(a
+ b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && NeQ[b^2 - 4*a*c, 0] &&  !LeQ[p, -1]

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])

Rubi steps

\begin{align*} \int \frac{(g+h x) \left (d+e x+f x^2\right )}{\sqrt{a+b x+c x^2}} \, dx &=\frac{f (g+h x)^2 \sqrt{a+b x+c x^2}}{3 c h}+\frac{\int \frac{(g+h x) \left (-\frac{1}{2} h (b f g-6 c d h+4 a f h)-\frac{1}{2} h (2 c f g-6 c e h+5 b f h) x\right )}{\sqrt{a+b x+c x^2}} \, dx}{3 c h^2}\\ &=\frac{f (g+h x)^2 \sqrt{a+b x+c x^2}}{3 c h}+\frac{\left (15 b^2 f h^2-8 c^2 \left (f g^2-3 h (e g+d h)\right )-2 c h (8 a f h+9 b (f g+e h))-2 c h (2 c f g-6 c e h+5 b f h) x\right ) \sqrt{a+b x+c x^2}}{24 c^3 h}+\frac{\left (16 c^3 d g-5 b^3 f h-8 c^2 (b e g+a f g+b d h+a e h)+6 b c (b f g+b e h+2 a f h)\right ) \int \frac{1}{\sqrt{a+b x+c x^2}} \, dx}{16 c^3}\\ &=\frac{f (g+h x)^2 \sqrt{a+b x+c x^2}}{3 c h}+\frac{\left (15 b^2 f h^2-8 c^2 \left (f g^2-3 h (e g+d h)\right )-2 c h (8 a f h+9 b (f g+e h))-2 c h (2 c f g-6 c e h+5 b f h) x\right ) \sqrt{a+b x+c x^2}}{24 c^3 h}+\frac{\left (16 c^3 d g-5 b^3 f h-8 c^2 (b e g+a f g+b d h+a e h)+6 b c (b f g+b e h+2 a f h)\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 )}{8 c^3}\\ &=\frac{f (g+h x)^2 \sqrt{a+b x+c x^2}}{3 c h}+\frac{\left (15 b^2 f h^2-8 c^2 \left (f g^2-3 h (e g+d h)\right )-2 c h (8 a f h+9 b (f g+e h))-2 c h (2 c f g-6 c e h+5 b f h) x\right ) \sqrt{a+b x+c x^2}}{24 c^3 h}+\frac{\left (16 c^3 d g-5 b^3 f h-8 c^2 (b e g+a f g+b d h+a e h)+6 b c (b f g+b e h+2 a f h)\right ) \tanh ^{-1}\left (\frac{b+2 c x}{2 \sqrt{c} \sqrt{a+b x+c x^2}}\right )}{16 c^{7/2}}\\ \end{align*}

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

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B]  time = 0.056, size = 505, normalized size = 2.3 \begin{align*}{\frac{fh{x}^{2}}{3\,c}\sqrt{c{x}^{2}+bx+a}}-{\frac{5\,bfhx}{12\,{c}^{2}}\sqrt{c{x}^{2}+bx+a}}+{\frac{5\,hf{b}^{2}}{8\,{c}^{3}}\sqrt{c{x}^{2}+bx+a}}-{\frac{5\,{b}^{3}fh}{16}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{7}{2}}}}+{\frac{3\,abfh}{4}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{5}{2}}}}-{\frac{2\,afh}{3\,{c}^{2}}\sqrt{c{x}^{2}+bx+a}}+{\frac{ehx}{2\,c}\sqrt{c{x}^{2}+bx+a}}+{\frac{fgx}{2\,c}\sqrt{c{x}^{2}+bx+a}}-{\frac{3\,beh}{4\,{c}^{2}}\sqrt{c{x}^{2}+bx+a}}-{\frac{3\,bfg}{4\,{c}^{2}}\sqrt{c{x}^{2}+bx+a}}+{\frac{3\,{b}^{2}eh}{8}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{5}{2}}}}+{\frac{3\,{b}^{2}fg}{8}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{5}{2}}}}-{\frac{aeh}{2}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{3}{2}}}}-{\frac{afg}{2}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{3}{2}}}}+{\frac{dh}{c}\sqrt{c{x}^{2}+bx+a}}+{\frac{eg}{c}\sqrt{c{x}^{2}+bx+a}}-{\frac{bdh}{2}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{3}{2}}}}-{\frac{beg}{2}\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){c}^{-{\frac{3}{2}}}}+{dg\ln \left ({ \left ({\frac{b}{2}}+cx \right ){\frac{1}{\sqrt{c}}}}+\sqrt{c{x}^{2}+bx+a} \right ){\frac{1}{\sqrt{c}}}} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

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((h*x+g)*(f*x^2+e*x+d)/(c*x^2+b*x+a)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 2.4843, size = 1060, normalized size = 4.75 \begin{align*} \left [\frac{3 \,{\left (2 \,{\left (8 \, c^{3} d - 4 \, b c^{2} e +{\left (3 \, b^{2} c - 4 \, a c^{2}\right )} f\right )} g -{\left (8 \, b c^{2} d - 2 \,{\left (3 \, b^{2} c - 4 \, a c^{2}\right )} e +{\left (5 \, b^{3} - 12 \, a b c\right )} f\right )} h\right )} \sqrt{c} \log \left (-8 \, c^{2} x^{2} - 8 \, b c x - b^{2} - 4 \, \sqrt{c x^{2} + b x + a}{\left (2 \, c x + b\right )} \sqrt{c} - 4 \, a c\right ) + 4 \,{\left (8 \, c^{3} f h x^{2} + 6 \,{\left (4 \, c^{3} e - 3 \, b c^{2} f\right )} g +{\left (24 \, c^{3} d - 18 \, b c^{2} e +{\left (15 \, b^{2} c - 16 \, a c^{2}\right )} f\right )} h + 2 \,{\left (6 \, c^{3} f g +{\left (6 \, c^{3} e - 5 \, b c^{2} f\right )} h\right )} x\right )} \sqrt{c x^{2} + b x + a}}{96 \, c^{4}}, -\frac{3 \,{\left (2 \,{\left (8 \, c^{3} d - 4 \, b c^{2} e +{\left (3 \, b^{2} c - 4 \, a c^{2}\right )} f\right )} g -{\left (8 \, b c^{2} d - 2 \,{\left (3 \, b^{2} c - 4 \, a c^{2}\right )} e +{\left (5 \, b^{3} - 12 \, a b c\right )} f\right )} h\right )} \sqrt{-c} \arctan \left (\frac{\sqrt{c x^{2} + b x + a}{\left (2 \, c x + b\right )} \sqrt{-c}}{2 \,{\left (c^{2} x^{2} + b c x + a c\right )}}\right ) - 2 \,{\left (8 \, c^{3} f h x^{2} + 6 \,{\left (4 \, c^{3} e - 3 \, b c^{2} f\right )} g +{\left (24 \, c^{3} d - 18 \, b c^{2} e +{\left (15 \, b^{2} c - 16 \, a c^{2}\right )} f\right )} h + 2 \,{\left (6 \, c^{3} f g +{\left (6 \, c^{3} e - 5 \, b c^{2} f\right )} h\right )} x\right )} \sqrt{c x^{2} + b x + a}}{48 \, c^{4}}\right ] \end{align*}

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

[In]

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

[Out]

[1/96*(3*(2*(8*c^3*d - 4*b*c^2*e + (3*b^2*c - 4*a*c^2)*f)*g - (8*b*c^2*d - 2*(3*b^2*c - 4*a*c^2)*e + (5*b^3 -
12*a*b*c)*f)*h)*sqrt(c)*log(-8*c^2*x^2 - 8*b*c*x - b^2 - 4*sqrt(c*x^2 + b*x + a)*(2*c*x + b)*sqrt(c) - 4*a*c)
+ 4*(8*c^3*f*h*x^2 + 6*(4*c^3*e - 3*b*c^2*f)*g + (24*c^3*d - 18*b*c^2*e + (15*b^2*c - 16*a*c^2)*f)*h + 2*(6*c^
3*f*g + (6*c^3*e - 5*b*c^2*f)*h)*x)*sqrt(c*x^2 + b*x + a))/c^4, -1/48*(3*(2*(8*c^3*d - 4*b*c^2*e + (3*b^2*c -
4*a*c^2)*f)*g - (8*b*c^2*d - 2*(3*b^2*c - 4*a*c^2)*e + (5*b^3 - 12*a*b*c)*f)*h)*sqrt(-c)*arctan(1/2*sqrt(c*x^2
+ b*x + a)*(2*c*x + b)*sqrt(-c)/(c^2*x^2 + b*c*x + a*c)) - 2*(8*c^3*f*h*x^2 + 6*(4*c^3*e - 3*b*c^2*f)*g + (24
*c^3*d - 18*b*c^2*e + (15*b^2*c - 16*a*c^2)*f)*h + 2*(6*c^3*f*g + (6*c^3*e - 5*b*c^2*f)*h)*x)*sqrt(c*x^2 + b*x
+ a))/c^4]

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (g + h x\right ) \left (d + e x + f x^{2}\right )}{\sqrt{a + b x + c x^{2}}}\, dx \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.22228, size = 284, normalized size = 1.27 \begin{align*} \frac{1}{24} \, \sqrt{c x^{2} + b x + a}{\left (2 \,{\left (\frac{4 \, f h x}{c} + \frac{6 \, c^{2} f g - 5 \, b c f h + 6 \, c^{2} h e}{c^{3}}\right )} x - \frac{18 \, b c f g - 24 \, c^{2} d h - 15 \, b^{2} f h + 16 \, a c f h - 24 \, c^{2} g e + 18 \, b c h e}{c^{3}}\right )} - \frac{{\left (16 \, c^{3} d g + 6 \, b^{2} c f g - 8 \, a c^{2} f g - 8 \, b c^{2} d h - 5 \, b^{3} f h + 12 \, a b c f h - 8 \, b c^{2} g e + 6 \, b^{2} c h e - 8 \, a c^{2} h e\right )} \log \left ({\left | -2 \,{\left (\sqrt{c} x - \sqrt{c x^{2} + b x + a}\right )} \sqrt{c} - b \right |}\right )}{16 \, c^{\frac{7}{2}}} \end{align*}

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

[In]

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

[Out]

1/24*sqrt(c*x^2 + b*x + a)*(2*(4*f*h*x/c + (6*c^2*f*g - 5*b*c*f*h + 6*c^2*h*e)/c^3)*x - (18*b*c*f*g - 24*c^2*d
*h - 15*b^2*f*h + 16*a*c*f*h - 24*c^2*g*e + 18*b*c*h*e)/c^3) - 1/16*(16*c^3*d*g + 6*b^2*c*f*g - 8*a*c^2*f*g -
8*b*c^2*d*h - 5*b^3*f*h + 12*a*b*c*f*h - 8*b*c^2*g*e + 6*b^2*c*h*e - 8*a*c^2*h*e)*log(abs(-2*(sqrt(c)*x - sqrt
(c*x^2 + b*x + a))*sqrt(c) - b))/c^(7/2)