### 3.2123 $$\int \frac{(a+b x+c x^2)^2}{d+e x} \, dx$$

Optimal. Leaf size=129 $\frac{x^2 \left (-2 c e (b d-a e)+b^2 e^2+c^2 d^2\right )}{2 e^3}-\frac{x (c d-b e) \left (c d^2-e (b d-2 a e)\right )}{e^4}+\frac{\log (d+e x) \left (a e^2-b d e+c d^2\right )^2}{e^5}-\frac{c x^3 (c d-2 b e)}{3 e^2}+\frac{c^2 x^4}{4 e}$

[Out]

-(((c*d - b*e)*(c*d^2 - e*(b*d - 2*a*e))*x)/e^4) + ((c^2*d^2 + b^2*e^2 - 2*c*e*(b*d - a*e))*x^2)/(2*e^3) - (c*
(c*d - 2*b*e)*x^3)/(3*e^2) + (c^2*x^4)/(4*e) + ((c*d^2 - b*d*e + a*e^2)^2*Log[d + e*x])/e^5

________________________________________________________________________________________

Rubi [A]  time = 0.155409, antiderivative size = 129, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 20, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.05, Rules used = {698} $\frac{x^2 \left (-2 c e (b d-a e)+b^2 e^2+c^2 d^2\right )}{2 e^3}-\frac{x (c d-b e) \left (c d^2-e (b d-2 a e)\right )}{e^4}+\frac{\log (d+e x) \left (a e^2-b d e+c d^2\right )^2}{e^5}-\frac{c x^3 (c d-2 b e)}{3 e^2}+\frac{c^2 x^4}{4 e}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

-(((c*d - b*e)*(c*d^2 - e*(b*d - 2*a*e))*x)/e^4) + ((c^2*d^2 + b^2*e^2 - 2*c*e*(b*d - a*e))*x^2)/(2*e^3) - (c*
(c*d - 2*b*e)*x^3)/(3*e^2) + (c^2*x^4)/(4*e) + ((c*d^2 - b*d*e + a*e^2)^2*Log[d + e*x])/e^5

Rule 698

Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d +
e*x)^m*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*
e + a*e^2, 0] && NeQ[2*c*d - b*e, 0] && IntegerQ[p] && (GtQ[p, 0] || (EqQ[a, 0] && IntegerQ[m]))

Rubi steps

\begin{align*} \int \frac{\left (a+b x+c x^2\right )^2}{d+e x} \, dx &=\int \left (\frac{(c d-b e) \left (-c d^2+e (b d-2 a e)\right )}{e^4}+\frac{\left (c^2 d^2+b^2 e^2-2 c e (b d-a e)\right ) x}{e^3}-\frac{c (c d-2 b e) x^2}{e^2}+\frac{c^2 x^3}{e}+\frac{\left (c d^2-b d e+a e^2\right )^2}{e^4 (d+e x)}\right ) \, dx\\ &=-\frac{(c d-b e) \left (c d^2-e (b d-2 a e)\right ) x}{e^4}+\frac{\left (c^2 d^2+b^2 e^2-2 c e (b d-a e)\right ) x^2}{2 e^3}-\frac{c (c d-2 b e) x^3}{3 e^2}+\frac{c^2 x^4}{4 e}+\frac{\left (c d^2-b d e+a e^2\right )^2 \log (d+e x)}{e^5}\\ \end{align*}

Mathematica [A]  time = 0.0629943, size = 128, normalized size = 0.99 $\frac{e x \left (4 c e \left (3 a e (e x-2 d)+b \left (6 d^2-3 d e x+2 e^2 x^2\right )\right )+6 b e^2 (4 a e-2 b d+b e x)+c^2 \left (6 d^2 e x-12 d^3-4 d e^2 x^2+3 e^3 x^3\right )\right )+12 \log (d+e x) \left (e (a e-b d)+c d^2\right )^2}{12 e^5}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(e*x*(6*b*e^2*(-2*b*d + 4*a*e + b*e*x) + c^2*(-12*d^3 + 6*d^2*e*x - 4*d*e^2*x^2 + 3*e^3*x^3) + 4*c*e*(3*a*e*(-
2*d + e*x) + b*(6*d^2 - 3*d*e*x + 2*e^2*x^2))) + 12*(c*d^2 + e*(-(b*d) + a*e))^2*Log[d + e*x])/(12*e^5)

________________________________________________________________________________________

Maple [A]  time = 0.042, size = 221, normalized size = 1.7 \begin{align*}{\frac{{c}^{2}{x}^{4}}{4\,e}}+{\frac{2\,bc{x}^{3}}{3\,e}}-{\frac{{c}^{2}d{x}^{3}}{3\,{e}^{2}}}+{\frac{ac{x}^{2}}{e}}+{\frac{{b}^{2}{x}^{2}}{2\,e}}-{\frac{bc{x}^{2}d}{{e}^{2}}}+{\frac{{c}^{2}{d}^{2}{x}^{2}}{2\,{e}^{3}}}+2\,{\frac{abx}{e}}-2\,{\frac{acdx}{{e}^{2}}}-{\frac{{b}^{2}dx}{{e}^{2}}}+2\,{\frac{{d}^{2}bcx}{{e}^{3}}}-{\frac{{c}^{2}{d}^{3}x}{{e}^{4}}}+{\frac{\ln \left ( ex+d \right ){a}^{2}}{e}}-2\,{\frac{\ln \left ( ex+d \right ) dab}{{e}^{2}}}+2\,{\frac{\ln \left ( ex+d \right ) ac{d}^{2}}{{e}^{3}}}+{\frac{{d}^{2}\ln \left ( ex+d \right ){b}^{2}}{{e}^{3}}}-2\,{\frac{{d}^{3}\ln \left ( ex+d \right ) bc}{{e}^{4}}}+{\frac{{d}^{4}\ln \left ( ex+d \right ){c}^{2}}{{e}^{5}}} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.00364, size = 227, normalized size = 1.76 \begin{align*} \frac{3 \, c^{2} e^{3} x^{4} - 4 \,{\left (c^{2} d e^{2} - 2 \, b c e^{3}\right )} x^{3} + 6 \,{\left (c^{2} d^{2} e - 2 \, b c d e^{2} +{\left (b^{2} + 2 \, a c\right )} e^{3}\right )} x^{2} - 12 \,{\left (c^{2} d^{3} - 2 \, b c d^{2} e - 2 \, a b e^{3} +{\left (b^{2} + 2 \, a c\right )} d e^{2}\right )} x}{12 \, e^{4}} + \frac{{\left (c^{2} d^{4} - 2 \, b c d^{3} e - 2 \, a b d e^{3} + a^{2} e^{4} +{\left (b^{2} + 2 \, a c\right )} d^{2} e^{2}\right )} \log \left (e x + d\right )}{e^{5}} \end{align*}

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

[In]

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

[Out]

1/12*(3*c^2*e^3*x^4 - 4*(c^2*d*e^2 - 2*b*c*e^3)*x^3 + 6*(c^2*d^2*e - 2*b*c*d*e^2 + (b^2 + 2*a*c)*e^3)*x^2 - 12
*(c^2*d^3 - 2*b*c*d^2*e - 2*a*b*e^3 + (b^2 + 2*a*c)*d*e^2)*x)/e^4 + (c^2*d^4 - 2*b*c*d^3*e - 2*a*b*d*e^3 + a^2
*e^4 + (b^2 + 2*a*c)*d^2*e^2)*log(e*x + d)/e^5

________________________________________________________________________________________

Fricas [A]  time = 2.01063, size = 369, normalized size = 2.86 \begin{align*} \frac{3 \, c^{2} e^{4} x^{4} - 4 \,{\left (c^{2} d e^{3} - 2 \, b c e^{4}\right )} x^{3} + 6 \,{\left (c^{2} d^{2} e^{2} - 2 \, b c d e^{3} +{\left (b^{2} + 2 \, a c\right )} e^{4}\right )} x^{2} - 12 \,{\left (c^{2} d^{3} e - 2 \, b c d^{2} e^{2} - 2 \, a b e^{4} +{\left (b^{2} + 2 \, a c\right )} d e^{3}\right )} x + 12 \,{\left (c^{2} d^{4} - 2 \, b c d^{3} e - 2 \, a b d e^{3} + a^{2} e^{4} +{\left (b^{2} + 2 \, a c\right )} d^{2} e^{2}\right )} \log \left (e x + d\right )}{12 \, e^{5}} \end{align*}

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

[In]

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

[Out]

1/12*(3*c^2*e^4*x^4 - 4*(c^2*d*e^3 - 2*b*c*e^4)*x^3 + 6*(c^2*d^2*e^2 - 2*b*c*d*e^3 + (b^2 + 2*a*c)*e^4)*x^2 -
12*(c^2*d^3*e - 2*b*c*d^2*e^2 - 2*a*b*e^4 + (b^2 + 2*a*c)*d*e^3)*x + 12*(c^2*d^4 - 2*b*c*d^3*e - 2*a*b*d*e^3 +
a^2*e^4 + (b^2 + 2*a*c)*d^2*e^2)*log(e*x + d))/e^5

________________________________________________________________________________________

Sympy [A]  time = 0.610411, size = 144, normalized size = 1.12 \begin{align*} \frac{c^{2} x^{4}}{4 e} + \frac{x^{3} \left (2 b c e - c^{2} d\right )}{3 e^{2}} + \frac{x^{2} \left (2 a c e^{2} + b^{2} e^{2} - 2 b c d e + c^{2} d^{2}\right )}{2 e^{3}} + \frac{x \left (2 a b e^{3} - 2 a c d e^{2} - b^{2} d e^{2} + 2 b c d^{2} e - c^{2} d^{3}\right )}{e^{4}} + \frac{\left (a e^{2} - b d e + c d^{2}\right )^{2} \log{\left (d + e x \right )}}{e^{5}} \end{align*}

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

[In]

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

[Out]

c**2*x**4/(4*e) + x**3*(2*b*c*e - c**2*d)/(3*e**2) + x**2*(2*a*c*e**2 + b**2*e**2 - 2*b*c*d*e + c**2*d**2)/(2*
e**3) + x*(2*a*b*e**3 - 2*a*c*d*e**2 - b**2*d*e**2 + 2*b*c*d**2*e - c**2*d**3)/e**4 + (a*e**2 - b*d*e + c*d**2
)**2*log(d + e*x)/e**5

________________________________________________________________________________________

Giac [A]  time = 1.1144, size = 243, normalized size = 1.88 \begin{align*}{\left (c^{2} d^{4} - 2 \, b c d^{3} e + b^{2} d^{2} e^{2} + 2 \, a c d^{2} e^{2} - 2 \, a b d e^{3} + a^{2} e^{4}\right )} e^{\left (-5\right )} \log \left ({\left | x e + d \right |}\right ) + \frac{1}{12} \,{\left (3 \, c^{2} x^{4} e^{3} - 4 \, c^{2} d x^{3} e^{2} + 6 \, c^{2} d^{2} x^{2} e - 12 \, c^{2} d^{3} x + 8 \, b c x^{3} e^{3} - 12 \, b c d x^{2} e^{2} + 24 \, b c d^{2} x e + 6 \, b^{2} x^{2} e^{3} + 12 \, a c x^{2} e^{3} - 12 \, b^{2} d x e^{2} - 24 \, a c d x e^{2} + 24 \, a b x e^{3}\right )} e^{\left (-4\right )} \end{align*}

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

[In]

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

[Out]

(c^2*d^4 - 2*b*c*d^3*e + b^2*d^2*e^2 + 2*a*c*d^2*e^2 - 2*a*b*d*e^3 + a^2*e^4)*e^(-5)*log(abs(x*e + d)) + 1/12*
(3*c^2*x^4*e^3 - 4*c^2*d*x^3*e^2 + 6*c^2*d^2*x^2*e - 12*c^2*d^3*x + 8*b*c*x^3*e^3 - 12*b*c*d*x^2*e^2 + 24*b*c*
d^2*x*e + 6*b^2*x^2*e^3 + 12*a*c*x^2*e^3 - 12*b^2*d*x*e^2 - 24*a*c*d*x*e^2 + 24*a*b*x*e^3)*e^(-4)