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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.676836, antiderivative size = 348, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 30, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.167, Rules used = {1628, 634, 618, 206, 628} $-\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (c^2 \left (2 a^2 e^2 h+3 a b e (2 d h+e g)+b^2 \left (d^2 h+2 d e g+e^2 f\right )\right )-b^2 c e (4 a e h+2 b d h+b e g)-c^3 \left (2 a \left (d^2 h+2 d e g+e^2 f\right )+b d (d g+2 e f)\right )+b^4 e^2 h+2 c^4 d^2 f\right )}{c^4 \sqrt{b^2-4 a c}}+\frac{\log \left (a+b x+c x^2\right ) \left (-c^2 \left (a e (2 d h+e g)+b \left (d^2 h+2 d e g+e^2 f\right )\right )+b c e (2 a e h+2 b d h+b e g)+b^3 \left (-e^2\right ) h+c^3 d (d g+2 e f)\right )}{2 c^4}+\frac{x \left (-c e (a e h+2 b d h+b e g)+b^2 e^2 h+c^2 \left (d^2 h+2 d e g+e^2 f\right )\right )}{c^3}+\frac{e x^2 (-b e h+2 c d h+c e g)}{2 c^2}+\frac{e^2 h x^3}{3 c}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 1628

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegra
nd[(d + e*x)^m*Pq*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 634

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

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], 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 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

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

Mathematica [A]  time = 0.364076, size = 345, normalized size = 0.99 $\frac{\frac{6 \tan ^{-1}\left (\frac{b+2 c x}{\sqrt{4 a c-b^2}}\right ) \left (c^2 \left (2 a^2 e^2 h+3 a b e (2 d h+e g)+b^2 \left (d^2 h+2 d e g+e^2 f\right )\right )-b^2 c e (4 a e h+2 b d h+b e g)-c^3 \left (2 a \left (d^2 h+2 d e g+e^2 f\right )+b d (d g+2 e f)\right )+b^4 e^2 h+2 c^4 d^2 f\right )}{\sqrt{4 a c-b^2}}+6 c x \left (-c e (a e h+2 b d h+b e g)+b^2 e^2 h+c^2 \left (d^2 h+2 d e g+e^2 f\right )\right )+3 \log (a+x (b+c x)) \left (-c^2 \left (a e (2 d h+e g)+b \left (d^2 h+2 d e g+e^2 f\right )\right )+b c e (2 a e h+2 b d h+b e g)+b^3 \left (-e^2\right ) h+c^3 d (d g+2 e f)\right )+3 c^2 e x^2 (-b e h+2 c d h+c e g)+2 c^3 e^2 h x^3}{6 c^4}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(6*c*(b^2*e^2*h + c^2*(e^2*f + 2*d*e*g + d^2*h) - c*e*(b*e*g + 2*b*d*h + a*e*h))*x + 3*c^2*e*(c*e*g + 2*c*d*h
- b*e*h)*x^2 + 2*c^3*e^2*h*x^3 + (6*(2*c^4*d^2*f + b^4*e^2*h - b^2*c*e*(b*e*g + 2*b*d*h + 4*a*e*h) - c^3*(b*d*
(2*e*f + d*g) + 2*a*(e^2*f + 2*d*e*g + d^2*h)) + c^2*(2*a^2*e^2*h + 3*a*b*e*(e*g + 2*d*h) + b^2*(e^2*f + 2*d*e
*g + d^2*h)))*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]])/Sqrt[-b^2 + 4*a*c] + 3*(c^3*d*(2*e*f + d*g) - b^3*e^2*h
+ b*c*e*(b*e*g + 2*b*d*h + 2*a*e*h) - c^2*(a*e*(e*g + 2*d*h) + b*(e^2*f + 2*d*e*g + d^2*h)))*Log[a + x*(b + c*
x)])/(6*c^4)

________________________________________________________________________________________

Maple [B]  time = 0.196, size = 1028, normalized size = 3. \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 3.85181, size = 2600, normalized size = 7.47 \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [B]  time = 37.3905, size = 2839, normalized size = 8.16 \begin{align*} \text{result too large to display} \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.25937, size = 575, normalized size = 1.65 \begin{align*} \frac{2 \, c^{2} h x^{3} e^{2} + 6 \, c^{2} d h x^{2} e + 6 \, c^{2} d^{2} h x + 3 \, c^{2} g x^{2} e^{2} - 3 \, b c h x^{2} e^{2} + 12 \, c^{2} d g x e - 12 \, b c d h x e + 6 \, c^{2} f x e^{2} - 6 \, b c g x e^{2} + 6 \, b^{2} h x e^{2} - 6 \, a c h x e^{2}}{6 \, c^{3}} + \frac{{\left (c^{3} d^{2} g - b c^{2} d^{2} h + 2 \, c^{3} d f e - 2 \, b c^{2} d g e + 2 \, b^{2} c d h e - 2 \, a c^{2} d h e - b c^{2} f e^{2} + b^{2} c g e^{2} - a c^{2} g e^{2} - b^{3} h e^{2} + 2 \, a b c h e^{2}\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{4}} + \frac{{\left (2 \, c^{4} d^{2} f - b c^{3} d^{2} g + b^{2} c^{2} d^{2} h - 2 \, a c^{3} d^{2} h - 2 \, b c^{3} d f e + 2 \, b^{2} c^{2} d g e - 4 \, a c^{3} d g e - 2 \, b^{3} c d h e + 6 \, a b c^{2} d h e + b^{2} c^{2} f e^{2} - 2 \, a c^{3} f e^{2} - b^{3} c g e^{2} + 3 \, a b c^{2} g e^{2} + b^{4} h e^{2} - 4 \, a b^{2} c h e^{2} + 2 \, a^{2} c^{2} h e^{2}\right )} \arctan \left (\frac{2 \, c x + b}{\sqrt{-b^{2} + 4 \, a c}}\right )}{\sqrt{-b^{2} + 4 \, a c} c^{4}} \end{align*}

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

[In]

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

[Out]

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