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

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 = 115 \[ \int \frac {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx=\frac {2 a c g-b (c f+a h)-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {2 (2 c f-b g+2 a h) \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:

(2*a*c*g-b*(a*h+c*f)-(-2*a*c*h+b^2*h-b*c*g+2*c^2*f)*x)/c/(-4*a*c+b^2)/(c*x 
^2+b*x+a)+2*(2*a*h-b*g+2*c*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.09 (sec) , antiderivative size = 114, normalized size of antiderivative = 0.99 \[ \int \frac {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx=\frac {a b h+2 c^2 f x+b^2 h x+b c (f-g x)-2 a c (g+h x)}{c \left (-b^2+4 a c\right ) (a+x (b+c x))}-\frac {2 (-2 c f+b g-2 a h) \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[(f + g*x + h*x^2)/(a + b*x + c*x^2)^2,x]
 

Output:

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

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.03, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {2191, 27, 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 {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx\)

\(\Big \downarrow \) 2191

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 1083

\(\displaystyle \frac {2 (2 a h-b g+2 c 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 {c \left (2 a g-b \left (\frac {a h}{c}+f\right )\right )-x \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )}{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 h-b g+2 c f)}{\left (b^2-4 a c\right )^{3/2}}+\frac {c \left (2 a g-b \left (\frac {a h}{c}+f\right )\right )-x \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}\)

Input:

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

Output:

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

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 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 2191
Int[(Pq_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = 
PolynomialQuotient[Pq, a + b*x + c*x^2, x], f = Coeff[PolynomialRemainder[P 
q, a + b*x + c*x^2, x], x, 0], g = Coeff[PolynomialRemainder[Pq, a + b*x + 
c*x^2, x], x, 1]}, Simp[(b*f - 2*a*g + (2*c*f - b*g)*x)*((a + b*x + c*x^2)^ 
(p + 1)/((p + 1)*(b^2 - 4*a*c))), x] + Simp[1/((p + 1)*(b^2 - 4*a*c))   Int 
[(a + b*x + c*x^2)^(p + 1)*ExpandToSum[(p + 1)*(b^2 - 4*a*c)*Q - (2*p + 3)* 
(2*c*f - b*g), x], x], x]] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && NeQ[b^ 
2 - 4*a*c, 0] && LtQ[p, -1]
 
Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.16

method result size
default \(\frac {-\frac {\left (2 a c h -b^{2} h +b c g -2 c^{2} f \right ) x}{c \left (4 a c -b^{2}\right )}+\frac {a b h -2 a c g +b c f}{c \left (4 a c -b^{2}\right )}}{c \,x^{2}+b x +a}+\frac {2 \left (2 a h -b g +2 c f \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}}}\) \(133\)
risch \(\frac {-\frac {\left (2 a c h -b^{2} h +b c g -2 c^{2} f \right ) x}{c \left (4 a c -b^{2}\right )}+\frac {a b h -2 a c g +b c 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 h}{\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 g}{\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 ) c 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 ) a h}{\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 g}{\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 ) c f}{\left (-4 a c +b^{2}\right )^{\frac {3}{2}}}\) \(385\)

Input:

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

Output:

(-(2*a*c*h-b^2*h+b*c*g-2*c^2*f)/c/(4*a*c-b^2)*x+1/c*(a*b*h-2*a*c*g+b*c*f)/ 
(4*a*c-b^2))/(c*x^2+b*x+a)+2*(2*a*h-b*g+2*c*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. 307 vs. \(2 (111) = 222\).

Time = 0.09 (sec) , antiderivative size = 632, normalized size of antiderivative = 5.50 \[ \int \frac {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx=\left [-\frac {{\left (2 \, a c^{2} f - a b c g + 2 \, a^{2} c h + {\left (2 \, c^{3} f - b c^{2} g + 2 \, a c^{2} h\right )} x^{2} + {\left (2 \, b c^{2} f - b^{2} c g + 2 \, a b c h\right )} x\right )} \sqrt {b^{2} - 4 \, a c} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c - \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) + {\left (b^{3} c - 4 \, a b c^{2}\right )} f - 2 \, {\left (a b^{2} c - 4 \, a^{2} c^{2}\right )} g + {\left (a b^{3} - 4 \, a^{2} b c\right )} h + {\left (2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )} f - {\left (b^{3} c - 4 \, a b c^{2}\right )} g + {\left (b^{4} - 6 \, a b^{2} c + 8 \, a^{2} c^{2}\right )} h\right )} x}{a b^{4} c - 8 \, a^{2} b^{2} c^{2} + 16 \, a^{3} c^{3} + {\left (b^{4} c^{2} - 8 \, a b^{2} c^{3} + 16 \, a^{2} c^{4}\right )} x^{2} + {\left (b^{5} c - 8 \, a b^{3} c^{2} + 16 \, a^{2} b c^{3}\right )} x}, \frac {2 \, {\left (2 \, a c^{2} f - a b c g + 2 \, a^{2} c h + {\left (2 \, c^{3} f - b c^{2} g + 2 \, a c^{2} h\right )} x^{2} + {\left (2 \, b c^{2} f - b^{2} c g + 2 \, a b c h\right )} x\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) - {\left (b^{3} c - 4 \, a b c^{2}\right )} f + 2 \, {\left (a b^{2} c - 4 \, a^{2} c^{2}\right )} g - {\left (a b^{3} - 4 \, a^{2} b c\right )} h - {\left (2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )} f - {\left (b^{3} c - 4 \, a b c^{2}\right )} g + {\left (b^{4} - 6 \, a b^{2} c + 8 \, a^{2} c^{2}\right )} h\right )} x}{a b^{4} c - 8 \, a^{2} b^{2} c^{2} + 16 \, a^{3} c^{3} + {\left (b^{4} c^{2} - 8 \, a b^{2} c^{3} + 16 \, a^{2} c^{4}\right )} x^{2} + {\left (b^{5} c - 8 \, a b^{3} c^{2} + 16 \, a^{2} b c^{3}\right )} x}\right ] \] Input:

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

Output:

[-((2*a*c^2*f - a*b*c*g + 2*a^2*c*h + (2*c^3*f - b*c^2*g + 2*a*c^2*h)*x^2 
+ (2*b*c^2*f - b^2*c*g + 2*a*b*c*h)*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)*f - 2*(a*b^2*c - 4*a^2*c^2)*g + (a*b^3 - 4*a^2*b*c)* 
h + (2*(b^2*c^2 - 4*a*c^3)*f - (b^3*c - 4*a*b*c^2)*g + (b^4 - 6*a*b^2*c + 
8*a^2*c^2)*h)*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*a 
*c^2*f - a*b*c*g + 2*a^2*c*h + (2*c^3*f - b*c^2*g + 2*a*c^2*h)*x^2 + (2*b* 
c^2*f - b^2*c*g + 2*a*b*c*h)*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)*f + 2*(a*b^2*c - 4*a^ 
2*c^2)*g - (a*b^3 - 4*a^2*b*c)*h - (2*(b^2*c^2 - 4*a*c^3)*f - (b^3*c - 4*a 
*b*c^2)*g + (b^4 - 6*a*b^2*c + 8*a^2*c^2)*h)*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. 459 vs. \(2 (107) = 214\).

Time = 1.13 (sec) , antiderivative size = 459, normalized size of antiderivative = 3.99 \[ \int \frac {f+g x+h x^2}{\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 h - b g + 2 c 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 h - b g + 2 c f\right ) + 8 a b^{2} c \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a h - b g + 2 c f\right ) + 2 a b h - b^{4} \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a h - b g + 2 c f\right ) - b^{2} g + 2 b c f}{4 a c h - 2 b c g + 4 c^{2} f} \right )} + \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a h - b g + 2 c 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 h - b g + 2 c f\right ) - 8 a b^{2} c \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a h - b g + 2 c f\right ) + 2 a b h + b^{4} \sqrt {- \frac {1}{\left (4 a c - b^{2}\right )^{3}}} \cdot \left (2 a h - b g + 2 c f\right ) - b^{2} g + 2 b c f}{4 a c h - 2 b c g + 4 c^{2} f} \right )} + \frac {a b h - 2 a c g + b c f + x \left (- 2 a c h + b^{2} h - b c g + 2 c^{2} 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((h*x**2+g*x+f)/(c*x**2+b*x+a)**2,x)
 

Output:

-sqrt(-1/(4*a*c - b**2)**3)*(2*a*h - b*g + 2*c*f)*log(x + (-16*a**2*c**2*s 
qrt(-1/(4*a*c - b**2)**3)*(2*a*h - b*g + 2*c*f) + 8*a*b**2*c*sqrt(-1/(4*a* 
c - b**2)**3)*(2*a*h - b*g + 2*c*f) + 2*a*b*h - b**4*sqrt(-1/(4*a*c - b**2 
)**3)*(2*a*h - b*g + 2*c*f) - b**2*g + 2*b*c*f)/(4*a*c*h - 2*b*c*g + 4*c** 
2*f)) + sqrt(-1/(4*a*c - b**2)**3)*(2*a*h - b*g + 2*c*f)*log(x + (16*a**2* 
c**2*sqrt(-1/(4*a*c - b**2)**3)*(2*a*h - b*g + 2*c*f) - 8*a*b**2*c*sqrt(-1 
/(4*a*c - b**2)**3)*(2*a*h - b*g + 2*c*f) + 2*a*b*h + b**4*sqrt(-1/(4*a*c 
- b**2)**3)*(2*a*h - b*g + 2*c*f) - b**2*g + 2*b*c*f)/(4*a*c*h - 2*b*c*g + 
 4*c**2*f)) + (a*b*h - 2*a*c*g + b*c*f + x*(-2*a*c*h + b**2*h - b*c*g + 2* 
c**2*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 {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx=\text {Exception raised: ValueError} \] Input:

integrate((h*x^2+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.16 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.09 \[ \int \frac {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx=-\frac {2 \, {\left (2 \, c f - b g + 2 \, a h\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} f x - b c g x + b^{2} h x - 2 \, a c h x + b c f - 2 \, a c g + a b h}{{\left (b^{2} c - 4 \, a c^{2}\right )} {\left (c x^{2} + b x + a\right )}} \] Input:

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

Output:

-2*(2*c*f - b*g + 2*a*h)*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*f*x - b*c*g*x + b^2*h*x - 2*a*c*h*x + b* 
c*f - 2*a*c*g + a*b*h)/((b^2*c - 4*a*c^2)*(c*x^2 + b*x + a))
 

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 571, normalized size of antiderivative = 4.97 \[ \int \frac {f+g x+h x^2}{\left (a+b x+c x^2\right )^2} \, dx=\frac {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 h -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} g +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} h 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 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 c h \,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^{3} g x +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 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 g \,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} f \,x^{2}+8 a^{3} c h -2 a^{2} b^{2} h -4 a^{2} b c g -8 a^{2} c^{2} f +8 a^{2} c^{2} h \,x^{2}+a \,b^{3} g +6 a \,b^{2} c f -6 a \,b^{2} c h \,x^{2}+4 a b \,c^{2} g \,x^{2}-8 a \,c^{3} f \,x^{2}-b^{4} f +b^{4} h \,x^{2}-b^{3} c g \,x^{2}+2 b^{2} c^{2} 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((h*x^2+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*h - 2*sq 
rt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2*g + 4*sqrt(4* 
a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b**2*h*x + 4*sqrt(4*a*c 
 - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b*c*f + 4*sqrt(4*a*c - b** 
2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*a*b*c*h*x**2 - 2*sqrt(4*a*c - b**2 
)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*b**3*g*x + 4*sqrt(4*a*c - b**2)*ata 
n((b + 2*c*x)/sqrt(4*a*c - b**2))*b**2*c*f*x - 2*sqrt(4*a*c - b**2)*atan(( 
b + 2*c*x)/sqrt(4*a*c - b**2))*b**2*c*g*x**2 + 4*sqrt(4*a*c - b**2)*atan(( 
b + 2*c*x)/sqrt(4*a*c - b**2))*b*c**2*f*x**2 + 8*a**3*c*h - 2*a**2*b**2*h 
- 4*a**2*b*c*g - 8*a**2*c**2*f + 8*a**2*c**2*h*x**2 + a*b**3*g + 6*a*b**2* 
c*f - 6*a*b**2*c*h*x**2 + 4*a*b*c**2*g*x**2 - 8*a*c**3*f*x**2 - b**4*f + b 
**4*h*x**2 - b**3*c*g*x**2 + 2*b**2*c**2*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))