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

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

Optimal result

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

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

Mathematica [A] (verified)

Time = 0.79 (sec) , antiderivative size = 431, normalized size of antiderivative = 1.39 \[ \int \frac {(d+e x)^2 (f+g x)^2}{\left (a+b x+c x^2\right )^2} \, dx=\frac {c e^2 g^2 x-\frac {b^4 e^2 g^2 x+b^3 e g (a e g-2 c (e f+d g) x)+b^2 c \left (c \left (e^2 f^2+4 d e f g+d^2 g^2\right ) x-2 a e g (e f+d g+2 e g x)\right )+2 c^2 \left (c^2 d^2 f^2 x+a^2 e g (2 e f+2 d g+e g x)-a c \left (e^2 f^2 x+d^2 g (2 f+g x)+2 d e f (f+2 g x)\right )\right )+b c \left (-3 a^2 e^2 g^2+c^2 d f (-2 e f x+d (f-2 g x))+a c \left (d^2 g^2+2 d e g (2 f+3 g x)+e^2 f (f+6 g x)\right )\right )}{\left (b^2-4 a c\right ) (a+x (b+c x))}+\frac {2 \left (2 c^4 d^2 f^2-b^4 e^2 g^2-6 a c^2 e g (b e f+b d g+a e g)+b^2 c e g (b e f+b d g+6 a e g)+c^3 \left (-2 b d f (e f+d g)+2 a \left (e^2 f^2+4 d e f g+d^2 g^2\right )\right )\right ) \arctan \left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{\left (-b^2+4 a c\right )^{3/2}}+e g (c e f+c d g-b e g) \log (a+x (b+c x))}{c^3} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 1.43 (sec) , antiderivative size = 324, normalized size of antiderivative = 1.05, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.148, Rules used = {1263, 27, 1200, 2009}

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

\(\Big \downarrow \) 1263

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 1200

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(d+e x)^2 \left (c \left (4 a f g-b \left (\frac {a g^2}{c}+f^2\right )\right )-x \left (-2 c g (a g+b f)+b^2 g^2+2 c^2 f^2\right )\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}-\frac {2 \left (-\frac {\text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (b^2 c e g (6 a e g+b d g+b e f)-c^3 \left (2 b d f (d g+e f)-2 a \left (d^2 g^2+4 d e f g+e^2 f^2\right )\right )-6 a c^2 e g (a e g+b d g+b e f)+b^4 \left (-e^2\right ) g^2+2 c^4 d^2 f^2\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {e g \left (b^2-4 a c\right ) \log \left (a+b x+c x^2\right ) (b e g-c (d g+e f))}{2 c^3}-\frac {e^2 x \left (-c g (3 a g+b f)+b^2 g^2+c^2 f^2\right )}{c^2}\right )}{b^2-4 a c}\)

Input:

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

Output:

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

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 1200
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_.) + (b_.)* 
(x_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g* 
x)^n/(a + b*x + c*x^2)), x], x] /; FreeQ[{a, b, c, d, e, f, g, m}, x] && In 
tegersQ[n]
 

rule 1263
Int[((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_)*((a_.) + (b_.)*(x_ 
) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[(f + g*x) 
^n, a + b*x + c*x^2, x], R = Coeff[PolynomialRemainder[(f + g*x)^n, a + b*x 
 + c*x^2, x], x, 0], S = Coeff[PolynomialRemainder[(f + g*x)^n, a + b*x + c 
*x^2, x], x, 1]}, Simp[(d + e*x)^m*(a + b*x + c*x^2)^(p + 1)*((R*b - 2*a*S 
+ (2*c*R - b*S)*x)/((p + 1)*(b^2 - 4*a*c))), x] + Simp[1/((p + 1)*(b^2 - 4* 
a*c))   Int[(d + e*x)^(m - 1)*(a + b*x + c*x^2)^(p + 1)*ExpandToSum[(p + 1) 
*(b^2 - 4*a*c)*(d + e*x)*Q + S*(2*a*e*m + b*d*(2*p + 3)) - R*(b*e*m + 2*c*d 
*(2*p + 3)) - e*(2*c*R - b*S)*(m + 2*p + 3)*x, x], x], x]] /; FreeQ[{a, b, 
c, d, e, f, g}, x] && IGtQ[n, 1] && LtQ[p, -1] && GtQ[m, 0] && NeQ[c*d^2 - 
b*d*e + a*e^2, 0]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(711\) vs. \(2(305)=610\).

Time = 2.60 (sec) , antiderivative size = 712, normalized size of antiderivative = 2.30

method result size
default \(\frac {e^{2} g^{2} x}{c^{2}}-\frac {\frac {-\frac {\left (2 a^{2} c^{2} e^{2} g^{2}-4 a \,b^{2} c \,e^{2} g^{2}+6 a b \,c^{2} d e \,g^{2}+6 a b \,c^{2} e^{2} f g -2 a \,c^{3} d^{2} g^{2}-8 a \,c^{3} d e f g -2 a \,c^{3} e^{2} f^{2}+b^{4} e^{2} g^{2}-2 b^{3} c d e \,g^{2}-2 b^{3} c \,e^{2} f g +b^{2} c^{2} d^{2} g^{2}+4 b^{2} c^{2} d e f g +b^{2} c^{2} e^{2} f^{2}-2 b \,c^{3} d^{2} f g -2 b \,c^{3} d e \,f^{2}+2 c^{4} d^{2} f^{2}\right ) x}{\left (4 a c -b^{2}\right ) c}+\frac {3 a^{2} b c \,e^{2} g^{2}-4 a^{2} c^{2} d e \,g^{2}-4 a^{2} c^{2} e^{2} f g -a \,b^{3} e^{2} g^{2}+2 a \,b^{2} c d e \,g^{2}+2 a \,b^{2} c \,e^{2} f g -a b \,c^{2} d^{2} g^{2}-4 a b \,c^{2} d e f g -a b \,c^{2} e^{2} f^{2}+4 a \,c^{3} d^{2} f g +4 a \,c^{3} d e \,f^{2}-b \,c^{3} d^{2} f^{2}}{\left (4 a c -b^{2}\right ) c}}{c \,x^{2}+b x +a}+\frac {\frac {\left (4 a b c \,e^{2} g^{2}-4 a \,c^{2} d e \,g^{2}-4 a \,c^{2} e^{2} f g -b^{3} e^{2} g^{2}+b^{2} c d e \,g^{2}+b^{2} c \,e^{2} f g \right ) \ln \left (c \,x^{2}+b x +a \right )}{c}+\frac {4 \left (3 a^{2} c \,e^{2} g^{2}-a \,b^{2} e^{2} g^{2}+a b c d e \,g^{2}+a b c \,e^{2} f g -a \,c^{2} d^{2} g^{2}-4 a \,c^{2} d e f g -a \,c^{2} e^{2} f^{2}+b \,c^{2} d^{2} f g +b \,c^{2} d e \,f^{2}-c^{3} d^{2} f^{2}-\frac {\left (4 a b c \,e^{2} g^{2}-4 a \,c^{2} d e \,g^{2}-4 a \,c^{2} e^{2} f g -b^{3} e^{2} g^{2}+b^{2} c d e \,g^{2}+b^{2} c \,e^{2} f g \right ) b}{2 c}\right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{4 a c -b^{2}}}{c^{2}}\) \(712\)
risch \(\text {Expression too large to display}\) \(13885\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1405 vs. \(2 (304) = 608\).

Time = 0.24 (sec) , antiderivative size = 2829, normalized size of antiderivative = 9.16 \[ \int \frac {(d+e x)^2 (f+g x)^2}{\left (a+b x+c x^2\right )^2} \, dx=\text {Too large to display} \] Input:

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

Output:

[((b^4*c^2 - 8*a*b^2*c^3 + 16*a^2*c^4)*e^2*g^2*x^3 + (b^5*c - 8*a*b^3*c^2 
+ 16*a^2*b*c^3)*e^2*g^2*x^2 - ((b^3*c^3 - 4*a*b*c^4)*d^2 - 4*(a*b^2*c^3 - 
4*a^2*c^4)*d*e + (a*b^3*c^2 - 4*a^2*b*c^3)*e^2)*f^2 + 2*(2*(a*b^2*c^3 - 4* 
a^2*c^4)*d^2 - 2*(a*b^3*c^2 - 4*a^2*b*c^3)*d*e + (a*b^4*c - 6*a^2*b^2*c^2 
+ 8*a^3*c^3)*e^2)*f*g - ((a*b^3*c^2 - 4*a^2*b*c^3)*d^2 - 2*(a*b^4*c - 6*a^ 
2*b^2*c^2 + 8*a^3*c^3)*d*e + (a*b^5 - 7*a^2*b^3*c + 12*a^3*b*c^2)*e^2)*g^2 
 + (2*(a*c^4*d^2 - a*b*c^3*d*e + a^2*c^3*e^2)*f^2 - (2*a*b*c^3*d^2 - 8*a^2 
*c^3*d*e - (a*b^3*c - 6*a^2*b*c^2)*e^2)*f*g + (2*a^2*c^3*d^2 + (a*b^3*c - 
6*a^2*b*c^2)*d*e - (a*b^4 - 6*a^2*b^2*c + 6*a^3*c^2)*e^2)*g^2 + (2*(c^5*d^ 
2 - b*c^4*d*e + a*c^4*e^2)*f^2 - (2*b*c^4*d^2 - 8*a*c^4*d*e - (b^3*c^2 - 6 
*a*b*c^3)*e^2)*f*g + (2*a*c^4*d^2 + (b^3*c^2 - 6*a*b*c^3)*d*e - (b^4*c - 6 
*a*b^2*c^2 + 6*a^2*c^3)*e^2)*g^2)*x^2 + (2*(b*c^4*d^2 - b^2*c^3*d*e + a*b* 
c^3*e^2)*f^2 - (2*b^2*c^3*d^2 - 8*a*b*c^3*d*e - (b^4*c - 6*a*b^2*c^2)*e^2) 
*f*g + (2*a*b*c^3*d^2 + (b^4*c - 6*a*b^2*c^2)*d*e - (b^5 - 6*a*b^3*c + 6*a 
^2*b*c^2)*e^2)*g^2)*x)*sqrt(b^2 - 4*a*c)*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)) - ((2*(b^2*c^4 - 
 4*a*c^5)*d^2 - 2*(b^3*c^3 - 4*a*b*c^4)*d*e + (b^4*c^2 - 6*a*b^2*c^3 + 8*a 
^2*c^4)*e^2)*f^2 - 2*((b^3*c^3 - 4*a*b*c^4)*d^2 - 2*(b^4*c^2 - 6*a*b^2*c^3 
 + 8*a^2*c^4)*d*e + (b^5*c - 7*a*b^3*c^2 + 12*a^2*b*c^3)*e^2)*f*g + ((b^4* 
c^2 - 6*a*b^2*c^3 + 8*a^2*c^4)*d^2 - 2*(b^5*c - 7*a*b^3*c^2 + 12*a^2*b*...
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 3225 vs. \(2 (309) = 618\).

Time = 47.85 (sec) , antiderivative size = 3225, normalized size of antiderivative = 10.44 \[ \int \frac {(d+e x)^2 (f+g x)^2}{\left (a+b x+c x^2\right )^2} \, dx=\text {Too large to display} \] Input:

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

Output:

(-e*g*(b*e*g - c*d*g - c*e*f)/c**3 - sqrt(-(4*a*c - b**2)**3)*(6*a**2*c**2 
*e**2*g**2 - 6*a*b**2*c*e**2*g**2 + 6*a*b*c**2*d*e*g**2 + 6*a*b*c**2*e**2* 
f*g - 2*a*c**3*d**2*g**2 - 8*a*c**3*d*e*f*g - 2*a*c**3*e**2*f**2 + b**4*e* 
*2*g**2 - b**3*c*d*e*g**2 - b**3*c*e**2*f*g + 2*b*c**3*d**2*f*g + 2*b*c**3 
*d*e*f**2 - 2*c**4*d**2*f**2)/(c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12 
*a*b**4*c - b**6)))*log(x + (-10*a**2*b*c*e**2*g**2 - 16*a**2*c**4*(-e*g*( 
b*e*g - c*d*g - c*e*f)/c**3 - sqrt(-(4*a*c - b**2)**3)*(6*a**2*c**2*e**2*g 
**2 - 6*a*b**2*c*e**2*g**2 + 6*a*b*c**2*d*e*g**2 + 6*a*b*c**2*e**2*f*g - 2 
*a*c**3*d**2*g**2 - 8*a*c**3*d*e*f*g - 2*a*c**3*e**2*f**2 + b**4*e**2*g**2 
 - b**3*c*d*e*g**2 - b**3*c*e**2*f*g + 2*b*c**3*d**2*f*g + 2*b*c**3*d*e*f* 
*2 - 2*c**4*d**2*f**2)/(c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12*a*b**4 
*c - b**6))) + 16*a**2*c**2*d*e*g**2 + 16*a**2*c**2*e**2*f*g + 2*a*b**3*e* 
*2*g**2 + 8*a*b**2*c**3*(-e*g*(b*e*g - c*d*g - c*e*f)/c**3 - sqrt(-(4*a*c 
- b**2)**3)*(6*a**2*c**2*e**2*g**2 - 6*a*b**2*c*e**2*g**2 + 6*a*b*c**2*d*e 
*g**2 + 6*a*b*c**2*e**2*f*g - 2*a*c**3*d**2*g**2 - 8*a*c**3*d*e*f*g - 2*a* 
c**3*e**2*f**2 + b**4*e**2*g**2 - b**3*c*d*e*g**2 - b**3*c*e**2*f*g + 2*b* 
c**3*d**2*f*g + 2*b*c**3*d*e*f**2 - 2*c**4*d**2*f**2)/(c**3*(64*a**3*c**3 
- 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6))) - 2*a*b**2*c*d*e*g**2 - 2*a*b* 
*2*c*e**2*f*g - 2*a*b*c**2*d**2*g**2 - 8*a*b*c**2*d*e*f*g - 2*a*b*c**2*e** 
2*f**2 - b**4*c**2*(-e*g*(b*e*g - c*d*g - c*e*f)/c**3 - sqrt(-(4*a*c - ...
 

Maxima [F(-2)]

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

integrate((e*x+d)^2*(g*x+f)^2/(c*x^2+b*x+a)^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(4*a*c-b^2>0)', see `assume?` for 
 more deta
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 620 vs. \(2 (304) = 608\).

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 15.88 (sec) , antiderivative size = 833, normalized size of antiderivative = 2.70 \[ \int \frac {(d+e x)^2 (f+g x)^2}{\left (a+b x+c x^2\right )^2} \, dx=\frac {\frac {-3\,a^2\,b\,c\,e^2\,g^2+4\,a^2\,c^2\,d\,e\,g^2+4\,a^2\,c^2\,e^2\,f\,g+a\,b^3\,e^2\,g^2-2\,a\,b^2\,c\,d\,e\,g^2-2\,a\,b^2\,c\,e^2\,f\,g+a\,b\,c^2\,d^2\,g^2+4\,a\,b\,c^2\,d\,e\,f\,g+a\,b\,c^2\,e^2\,f^2-4\,a\,c^3\,d^2\,f\,g-4\,a\,c^3\,d\,e\,f^2+b\,c^3\,d^2\,f^2}{c\,\left (4\,a\,c-b^2\right )}+\frac {x\,\left (2\,a^2\,c^2\,e^2\,g^2-4\,a\,b^2\,c\,e^2\,g^2+6\,a\,b\,c^2\,d\,e\,g^2+6\,a\,b\,c^2\,e^2\,f\,g-2\,a\,c^3\,d^2\,g^2-8\,a\,c^3\,d\,e\,f\,g-2\,a\,c^3\,e^2\,f^2+b^4\,e^2\,g^2-2\,b^3\,c\,d\,e\,g^2-2\,b^3\,c\,e^2\,f\,g+b^2\,c^2\,d^2\,g^2+4\,b^2\,c^2\,d\,e\,f\,g+b^2\,c^2\,e^2\,f^2-2\,b\,c^3\,d^2\,f\,g-2\,b\,c^3\,d\,e\,f^2+2\,c^4\,d^2\,f^2\right )}{c\,\left (4\,a\,c-b^2\right )}}{c^3\,x^2+b\,c^2\,x+a\,c^2}+\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (-128\,a^3\,b\,c^3\,e^2\,g^2+128\,f\,a^3\,c^4\,e^2\,g+128\,d\,a^3\,c^4\,e\,g^2+96\,a^2\,b^3\,c^2\,e^2\,g^2-96\,f\,a^2\,b^2\,c^3\,e^2\,g-96\,d\,a^2\,b^2\,c^3\,e\,g^2-24\,a\,b^5\,c\,e^2\,g^2+24\,f\,a\,b^4\,c^2\,e^2\,g+24\,d\,a\,b^4\,c^2\,e\,g^2+2\,b^7\,e^2\,g^2-2\,f\,b^6\,c\,e^2\,g-2\,d\,b^6\,c\,e\,g^2\right )}{2\,\left (64\,a^3\,c^6-48\,a^2\,b^2\,c^5+12\,a\,b^4\,c^4-b^6\,c^3\right )}+\frac {e^2\,g^2\,x}{c^2}+\frac {2\,\mathrm {atan}\left (\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}-\frac {b^3\,c^2-4\,a\,b\,c^3}{c^2\,{\left (4\,a\,c-b^2\right )}^{3/2}}\right )\,\left (-6\,a^2\,c^2\,e^2\,g^2+6\,a\,b^2\,c\,e^2\,g^2-6\,a\,b\,c^2\,d\,e\,g^2-6\,a\,b\,c^2\,e^2\,f\,g+2\,a\,c^3\,d^2\,g^2+8\,a\,c^3\,d\,e\,f\,g+2\,a\,c^3\,e^2\,f^2-b^4\,e^2\,g^2+b^3\,c\,d\,e\,g^2+b^3\,c\,e^2\,f\,g-2\,b\,c^3\,d^2\,f\,g-2\,b\,c^3\,d\,e\,f^2+2\,c^4\,d^2\,f^2\right )}{c^3\,{\left (4\,a\,c-b^2\right )}^{3/2}} \] Input:

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

Output:

((a*b^3*e^2*g^2 + b*c^3*d^2*f^2 - 4*a*c^3*d*e*f^2 - 4*a*c^3*d^2*f*g + a*b* 
c^2*d^2*g^2 + a*b*c^2*e^2*f^2 - 3*a^2*b*c*e^2*g^2 + 4*a^2*c^2*d*e*g^2 + 4* 
a^2*c^2*e^2*f*g - 2*a*b^2*c*d*e*g^2 - 2*a*b^2*c*e^2*f*g + 4*a*b*c^2*d*e*f* 
g)/(c*(4*a*c - b^2)) + (x*(2*c^4*d^2*f^2 + b^4*e^2*g^2 - 2*a*c^3*d^2*g^2 - 
 2*a*c^3*e^2*f^2 + 2*a^2*c^2*e^2*g^2 + b^2*c^2*d^2*g^2 + b^2*c^2*e^2*f^2 - 
 2*b*c^3*d*e*f^2 - 2*b^3*c*d*e*g^2 - 2*b*c^3*d^2*f*g - 2*b^3*c*e^2*f*g - 4 
*a*b^2*c*e^2*g^2 - 8*a*c^3*d*e*f*g + 6*a*b*c^2*d*e*g^2 + 6*a*b*c^2*e^2*f*g 
 + 4*b^2*c^2*d*e*f*g))/(c*(4*a*c - b^2)))/(a*c^2 + c^3*x^2 + b*c^2*x) + (l 
og(a + b*x + c*x^2)*(2*b^7*e^2*g^2 - 2*b^6*c*d*e*g^2 - 2*b^6*c*e^2*f*g + 9 
6*a^2*b^3*c^2*e^2*g^2 - 24*a*b^5*c*e^2*g^2 + 128*a^3*c^4*d*e*g^2 + 128*a^3 
*c^4*e^2*f*g - 128*a^3*b*c^3*e^2*g^2 - 96*a^2*b^2*c^3*d*e*g^2 - 96*a^2*b^2 
*c^3*e^2*f*g + 24*a*b^4*c^2*d*e*g^2 + 24*a*b^4*c^2*e^2*f*g))/(2*(64*a^3*c^ 
6 - b^6*c^3 + 12*a*b^4*c^4 - 48*a^2*b^2*c^5)) + (e^2*g^2*x)/c^2 + (2*atan( 
(2*c*x)/(4*a*c - b^2)^(1/2) - (b^3*c^2 - 4*a*b*c^3)/(c^2*(4*a*c - b^2)^(3/ 
2)))*(2*c^4*d^2*f^2 - b^4*e^2*g^2 + 2*a*c^3*d^2*g^2 + 2*a*c^3*e^2*f^2 - 6* 
a^2*c^2*e^2*g^2 - 2*b*c^3*d*e*f^2 + b^3*c*d*e*g^2 - 2*b*c^3*d^2*f*g + b^3* 
c*e^2*f*g + 6*a*b^2*c*e^2*g^2 + 8*a*c^3*d*e*f*g - 6*a*b*c^2*d*e*g^2 - 6*a* 
b*c^2*e^2*f*g))/(c^3*(4*a*c - b^2)^(3/2))
 

Reduce [B] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 3376, normalized size of antiderivative = 10.93 \[ \int \frac {(d+e x)^2 (f+g x)^2}{\left (a+b x+c x^2\right )^2} \, dx =\text {Too large to display} \] Input:

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

Output:

( - 12*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a**3*b*c**2 
*e**2*g**2 + 12*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a* 
*2*b**3*c*e**2*g**2 - 12*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - 
b**2))*a**2*b**2*c**2*d*e*g**2 - 12*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sq 
rt(4*a*c - b**2))*a**2*b**2*c**2*e**2*f*g - 12*sqrt(4*a*c - b**2)*atan((b 
+ 2*c*x)/sqrt(4*a*c - b**2))*a**2*b**2*c**2*e**2*g**2*x + 4*sqrt(4*a*c - b 
**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a**2*b*c**3*d**2*g**2 + 16*sqrt( 
4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a**2*b*c**3*d*e*f*g + 4 
*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a**2*b*c**3*e**2* 
f**2 - 12*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a**2*b*c 
**3*e**2*g**2*x**2 - 2*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b* 
*2))*a*b**5*e**2*g**2 + 2*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - 
 b**2))*a*b**4*c*d*e*g**2 + 2*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a 
*c - b**2))*a*b**4*c*e**2*f*g + 12*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqr 
t(4*a*c - b**2))*a*b**4*c*e**2*g**2*x - 12*sqrt(4*a*c - b**2)*atan((b + 2* 
c*x)/sqrt(4*a*c - b**2))*a*b**3*c**2*d*e*g**2*x - 12*sqrt(4*a*c - b**2)*at 
an((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**3*c**2*e**2*f*g*x + 12*sqrt(4*a*c 
- b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**3*c**2*e**2*g**2*x**2 - 
4*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2*c**3*d**2 
*f*g + 4*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2...