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

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

Optimal result

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

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.51 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.35, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {1224, 1083, 219}

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

\(\Big \downarrow \) 1224

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

\(\Big \downarrow \) 1083

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

\(\Big \downarrow \) 219

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

Input:

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

Output:

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

Defintions of rubi rules used

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

rule 1083
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2   Subst[I 
nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, 
x]
 

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

Time = 1.72 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.53

method result size
default \(\frac {-\frac {\left (2 a c e g -b^{2} e g +b c d g +b c e f -2 c^{2} d f \right ) x}{\left (4 a c -b^{2}\right ) c}+\frac {a b e g -2 a c d g -2 a c e f +b c d f}{c \left (4 a c -b^{2}\right )}}{c \,x^{2}+b x +a}+\frac {2 \left (2 a e g -b d g -b e f +2 d f c \right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\left (4 a c -b^{2}\right )^{\frac {3}{2}}}\) \(159\)
risch \(\frac {-\frac {\left (2 a c e g -b^{2} e g +b c d g +b c e f -2 c^{2} d f \right ) x}{\left (4 a c -b^{2}\right ) c}+\frac {a b e g -2 a c d g -2 a c e f +b c d f}{c \left (4 a c -b^{2}\right )}}{c \,x^{2}+b x +a}+\frac {2 \ln \left (\left (-8 a \,c^{2}+2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}-4 a b c +b^{3}\right ) a e g}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}-\frac {\ln \left (\left (-8 a \,c^{2}+2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}-4 a b c +b^{3}\right ) b d g}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}-\frac {\ln \left (\left (-8 a \,c^{2}+2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}-4 a b c +b^{3}\right ) b e f}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}+\frac {2 \ln \left (\left (-8 a \,c^{2}+2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}-4 a b c +b^{3}\right ) d f c}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}-\frac {2 \ln \left (\left (8 a \,c^{2}-2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}+4 a b c -b^{3}\right ) a e g}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}+\frac {\ln \left (\left (8 a \,c^{2}-2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}+4 a b c -b^{3}\right ) b d g}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}+\frac {\ln \left (\left (8 a \,c^{2}-2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}+4 a b c -b^{3}\right ) b e f}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}-\frac {2 \ln \left (\left (8 a \,c^{2}-2 b^{2} c \right ) x +\left (-4 a c +b^{2}\right )^{\frac {3}{2}}+4 a b c -b^{3}\right ) d f c}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}\) \(510\)

Input:

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

Output:

(-(2*a*c*e*g-b^2*e*g+b*c*d*g+b*c*e*f-2*c^2*d*f)/(4*a*c-b^2)/c*x+(a*b*e*g-2 
*a*c*d*g-2*a*c*e*f+b*c*d*f)/c/(4*a*c-b^2))/(c*x^2+b*x+a)+2*(2*a*e*g-b*d*g- 
b*e*f+2*c*d*f)/(4*a*c-b^2)^(3/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. 392 vs. \(2 (100) = 200\).

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

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

Output:

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 619 vs. \(2 (102) = 204\).

Time = 1.71 (sec) , antiderivative size = 619, normalized size of antiderivative = 5.95 \[ \int \frac {(d+e x) (f+g x)}{\left (a+b x+c x^2\right )^2} \, dx=- \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) \log {\left (x + \frac {- 16 a^{2} c^{2} \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) + 8 a b^{2} c \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) + 2 a b e g - b^{4} \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) - b^{2} d g - b^{2} e f + 2 b c d f}{4 a c e g - 2 b c d g - 2 b c e f + 4 c^{2} d f} \right )} + \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) \log {\left (x + \frac {16 a^{2} c^{2} \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) - 8 a b^{2} c \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) + 2 a b e g + b^{4} \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a e g - b d g - b e f + 2 c d f\right ) - b^{2} d g - b^{2} e f + 2 b c d f}{4 a c e g - 2 b c d g - 2 b c e f + 4 c^{2} d f} \right )} + \frac {a b e g - 2 a c d g - 2 a c e f + b c d f + x \left (- 2 a c e g + b^{2} e g - b c d g - b c e f + 2 c^{2} d f\right )}{4 a^{2} c^{2} - a b^{2} c + x^{2} \cdot \left (4 a c^{3} - b^{2} c^{2}\right ) + x \left (4 a b c^{2} - b^{3} c\right )} \] Input:

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

Output:

-sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g - b*d*g - b*e*f + 2*c*d*f)*log(x + (- 
16*a**2*c**2*sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g - b*d*g - b*e*f + 2*c*d*f 
) + 8*a*b**2*c*sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g - b*d*g - b*e*f + 2*c*d 
*f) + 2*a*b*e*g - b**4*sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g - b*d*g - b*e*f 
 + 2*c*d*f) - b**2*d*g - b**2*e*f + 2*b*c*d*f)/(4*a*c*e*g - 2*b*c*d*g - 2* 
b*c*e*f + 4*c**2*d*f)) + sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g - b*d*g - b*e 
*f + 2*c*d*f)*log(x + (16*a**2*c**2*sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g - 
b*d*g - b*e*f + 2*c*d*f) - 8*a*b**2*c*sqrt(-1/(4*a*c - b**2)**3)*(2*a*e*g 
- b*d*g - b*e*f + 2*c*d*f) + 2*a*b*e*g + b**4*sqrt(-1/(4*a*c - b**2)**3)*( 
2*a*e*g - b*d*g - b*e*f + 2*c*d*f) - b**2*d*g - b**2*e*f + 2*b*c*d*f)/(4*a 
*c*e*g - 2*b*c*d*g - 2*b*c*e*f + 4*c**2*d*f)) + (a*b*e*g - 2*a*c*d*g - 2*a 
*c*e*f + b*c*d*f + x*(-2*a*c*e*g + b**2*e*g - b*c*d*g - b*c*e*f + 2*c**2*d 
*f))/(4*a**2*c**2 - a*b**2*c + x**2*(4*a*c**3 - b**2*c**2) + x*(4*a*b*c**2 
 - b**3*c))
 

Maxima [F(-2)]

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

integrate((e*x+d)*(g*x+f)/(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 [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.47 \[ \int \frac {(d+e x) (f+g x)}{\left (a+b x+c x^2\right )^2} \, dx=-\frac {2 \, {\left (2 \, c d f - b e f - b d g + 2 \, a e g\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{{\left (b^{2} - 4 \, a c\right )} \sqrt {-b^{2} + 4 \, a c}} - \frac {2 \, c^{2} d f x - b c e f x - b c d g x + b^{2} e g x - 2 \, a c e g x + b c d f - 2 \, a c e f - 2 \, a c d g + a b e g}{{\left (b^{2} c - 4 \, a c^{2}\right )} {\left (c x^{2} + b x + a\right )}} \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 254, normalized size of antiderivative = 2.44 \[ \int \frac {(d+e x) (f+g x)}{\left (a+b x+c x^2\right )^2} \, dx=\frac {\frac {a\,b\,e\,g-2\,a\,c\,d\,g-2\,a\,c\,e\,f+b\,c\,d\,f}{c\,\left (4\,a\,c-b^2\right )}-\frac {x\,\left (2\,a\,c\,e\,g-b^2\,e\,g-2\,c^2\,d\,f+b\,c\,d\,g+b\,c\,e\,f\right )}{c\,\left (4\,a\,c-b^2\right )}}{c\,x^2+b\,x+a}-\frac {2\,\mathrm {atan}\left (\frac {\left (4\,a\,c-b^2\right )\,\left (\frac {\left (b^3-4\,a\,b\,c\right )\,\left (2\,a\,e\,g-b\,d\,g-b\,e\,f+2\,c\,d\,f\right )}{{\left (4\,a\,c-b^2\right )}^{5/2}}-\frac {2\,c\,x\,\left (2\,a\,e\,g-b\,d\,g-b\,e\,f+2\,c\,d\,f\right )}{{\left (4\,a\,c-b^2\right )}^{3/2}}\right )}{2\,a\,e\,g-b\,d\,g-b\,e\,f+2\,c\,d\,f}\right )\,\left (2\,a\,e\,g-b\,d\,g-b\,e\,f+2\,c\,d\,f\right )}{{\left (4\,a\,c-b^2\right )}^{3/2}} \] Input:

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

Output:

((a*b*e*g - 2*a*c*d*g - 2*a*c*e*f + b*c*d*f)/(c*(4*a*c - b^2)) - (x*(2*a*c 
*e*g - b^2*e*g - 2*c^2*d*f + b*c*d*g + b*c*e*f))/(c*(4*a*c - b^2)))/(a + b 
*x + c*x^2) - (2*atan(((4*a*c - b^2)*(((b^3 - 4*a*b*c)*(2*a*e*g - b*d*g - 
b*e*f + 2*c*d*f))/(4*a*c - b^2)^(5/2) - (2*c*x*(2*a*e*g - b*d*g - b*e*f + 
2*c*d*f))/(4*a*c - b^2)^(3/2)))/(2*a*e*g - b*d*g - b*e*f + 2*c*d*f))*(2*a* 
e*g - b*d*g - b*e*f + 2*c*d*f))/(4*a*c - b^2)^(3/2)
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 756, normalized size of antiderivative = 7.27 \[ \int \frac {(d+e x) (f+g x)}{\left (a+b x+c x^2\right )^2} \, dx=\frac {a \,b^{3} d g +a \,b^{3} e f -b^{4} d f +b^{4} e g \,x^{2}+8 a^{3} c e g -2 a^{2} b^{2} e g -8 a^{2} c^{2} d f +4 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) a \,b^{2} e g x +4 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) a b c d f +4 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) b^{2} c d f x -2 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) b^{2} c d g \,x^{2}-2 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) b^{2} c e f \,x^{2}+4 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) b \,c^{2} d f \,x^{2}+4 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) a b c e g \,x^{2}-b^{3} c e f \,x^{2}+4 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) a^{2} b e g -2 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) a \,b^{2} d g -2 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) a \,b^{2} e f -2 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) b^{3} d g x -2 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) b^{3} e f x -6 a \,b^{2} c e g \,x^{2}+4 a b \,c^{2} d g \,x^{2}+4 a b \,c^{2} e f \,x^{2}-b^{3} c d g \,x^{2}-4 a^{2} b c d g -4 a^{2} b c e f +8 a^{2} c^{2} e g \,x^{2}+6 a \,b^{2} c d f -8 a \,c^{3} d f \,x^{2}+2 b^{2} c^{2} d f \,x^{2}}{b \left (16 a^{2} c^{3} x^{2}-8 a \,b^{2} c^{2} x^{2}+b^{4} c \,x^{2}+16 a^{2} b \,c^{2} x -8 a \,b^{3} c x +b^{5} x +16 a^{3} c^{2}-8 a^{2} b^{2} c +a \,b^{4}\right )} \] Input:

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

Output:

(4*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a**2*b*e*g - 2* 
sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2*d*g - 2*sqr 
t(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2*e*f + 4*sqrt(4 
*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2*e*g*x + 4*sqrt(4* 
a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b*c*d*f + 4*sqrt(4*a*c 
- b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b*c*e*g*x**2 - 2*sqrt(4*a*c 
 - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b**3*d*g*x - 2*sqrt(4*a*c - 
b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b**3*e*f*x + 4*sqrt(4*a*c - b** 
2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b**2*c*d*f*x - 2*sqrt(4*a*c - b**2 
)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b**2*c*d*g*x**2 - 2*sqrt(4*a*c - b* 
*2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b**2*c*e*f*x**2 + 4*sqrt(4*a*c - 
b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b*c**2*d*f*x**2 + 8*a**3*c*e*g 
- 2*a**2*b**2*e*g - 4*a**2*b*c*d*g - 4*a**2*b*c*e*f - 8*a**2*c**2*d*f + 8* 
a**2*c**2*e*g*x**2 + a*b**3*d*g + a*b**3*e*f + 6*a*b**2*c*d*f - 6*a*b**2*c 
*e*g*x**2 + 4*a*b*c**2*d*g*x**2 + 4*a*b*c**2*e*f*x**2 - 8*a*c**3*d*f*x**2 
- b**4*d*f + b**4*e*g*x**2 - b**3*c*d*g*x**2 - b**3*c*e*f*x**2 + 2*b**2*c* 
*2*d*f*x**2)/(b*(16*a**3*c**2 - 8*a**2*b**2*c + 16*a**2*b*c**2*x + 16*a**2 
*c**3*x**2 + a*b**4 - 8*a*b**3*c*x - 8*a*b**2*c**2*x**2 + b**5*x + b**4*c* 
x**2))