3.51 $$\int \frac{(d+e x)^2 (A+B x+C x^2)}{(a+c x^2)^2} \, dx$$

Optimal. Leaf size=146 $\frac{\tan ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a}}\right ) \left (c d (2 a B e+a C d+A c d)+a e^2 (A c-3 a C)\right )}{2 a^{3/2} c^{5/2}}-\frac{(d+e x)^2 (a B-x (A c-a C))}{2 a c \left (a+c x^2\right )}-\frac{e^2 x (A c-3 a C)}{2 a c^2}+\frac{e \log \left (a+c x^2\right ) (B e+2 C d)}{2 c^2}$

[Out]

-((A*c - 3*a*C)*e^2*x)/(2*a*c^2) - ((a*B - (A*c - a*C)*x)*(d + e*x)^2)/(2*a*c*(a + c*x^2)) + ((a*(A*c - 3*a*C)
*e^2 + c*d*(A*c*d + a*C*d + 2*a*B*e))*ArcTan[(Sqrt[c]*x)/Sqrt[a]])/(2*a^(3/2)*c^(5/2)) + (e*(2*C*d + B*e)*Log[
a + c*x^2])/(2*c^2)

________________________________________________________________________________________

Rubi [A]  time = 0.245414, antiderivative size = 146, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 27, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.185, Rules used = {1645, 774, 635, 205, 260} $\frac{\tan ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a}}\right ) \left (c d (2 a B e+a C d+A c d)+a e^2 (A c-3 a C)\right )}{2 a^{3/2} c^{5/2}}-\frac{(d+e x)^2 (a B-x (A c-a C))}{2 a c \left (a+c x^2\right )}-\frac{e^2 x (A c-3 a C)}{2 a c^2}+\frac{e \log \left (a+c x^2\right ) (B e+2 C d)}{2 c^2}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

-((A*c - 3*a*C)*e^2*x)/(2*a*c^2) - ((a*B - (A*c - a*C)*x)*(d + e*x)^2)/(2*a*c*(a + c*x^2)) + ((a*(A*c - 3*a*C)
*e^2 + c*d*(A*c*d + a*C*d + 2*a*B*e))*ArcTan[(Sqrt[c]*x)/Sqrt[a]])/(2*a^(3/2)*c^(5/2)) + (e*(2*C*d + B*e)*Log[
a + c*x^2])/(2*c^2)

Rule 1645

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[Pq,
a + c*x^2, x], f = Coeff[PolynomialRemainder[Pq, a + c*x^2, x], x, 0], g = Coeff[PolynomialRemainder[Pq, a + c
*x^2, x], x, 1]}, Simp[((d + e*x)^m*(a + c*x^2)^(p + 1)*(a*g - c*f*x))/(2*a*c*(p + 1)), x] + Dist[1/(2*a*c*(p
+ 1)), Int[(d + e*x)^(m - 1)*(a + c*x^2)^(p + 1)*ExpandToSum[2*a*c*(p + 1)*(d + e*x)*Q - a*e*g*m + c*d*f*(2*p
+ 3) + c*e*f*(m + 2*p + 3)*x, x], x], x]] /; FreeQ[{a, c, d, e}, x] && PolyQ[Pq, x] && NeQ[c*d^2 + a*e^2, 0] &
& LtQ[p, -1] && GtQ[m, 0] &&  !(IGtQ[m, 0] && RationalQ[a, c, d, e] && (IntegerQ[p] || ILtQ[p + 1/2, 0]))

Rule 774

Int[(((d_.) + (e_.)*(x_))*((f_) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(e*g*x)/c, x] + Dist[1
/c, Int[(c*d*f - a*e*g + c*(e*f + d*g)*x)/(a + c*x^2), x], x] /; FreeQ[{a, c, d, e, f, g}, x]

Rule 635

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

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rubi steps

\begin{align*} \int \frac{(d+e x)^2 \left (A+B x+C x^2\right )}{\left (a+c x^2\right )^2} \, dx &=-\frac{(a B-(A c-a C) x) (d+e x)^2}{2 a c \left (a+c x^2\right )}-\frac{\int \frac{(d+e x) (-A c d-a C d-2 a B e+(A c-3 a C) e x)}{a+c x^2} \, dx}{2 a c}\\ &=-\frac{(A c-3 a C) e^2 x}{2 a c^2}-\frac{(a B-(A c-a C) x) (d+e x)^2}{2 a c \left (a+c x^2\right )}-\frac{\int \frac{-a (A c-3 a C) e^2+c d (-A c d-a C d-2 a B e)+c ((A c-3 a C) d e+e (-A c d-a C d-2 a B e)) x}{a+c x^2} \, dx}{2 a c^2}\\ &=-\frac{(A c-3 a C) e^2 x}{2 a c^2}-\frac{(a B-(A c-a C) x) (d+e x)^2}{2 a c \left (a+c x^2\right )}+\frac{(e (2 C d+B e)) \int \frac{x}{a+c x^2} \, dx}{c}+\frac{\left (a (A c-3 a C) e^2+c d (A c d+a C d+2 a B e)\right ) \int \frac{1}{a+c x^2} \, dx}{2 a c^2}\\ &=-\frac{(A c-3 a C) e^2 x}{2 a c^2}-\frac{(a B-(A c-a C) x) (d+e x)^2}{2 a c \left (a+c x^2\right )}+\frac{\left (a (A c-3 a C) e^2+c d (A c d+a C d+2 a B e)\right ) \tan ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a}}\right )}{2 a^{3/2} c^{5/2}}+\frac{e (2 C d+B e) \log \left (a+c x^2\right )}{2 c^2}\\ \end{align*}

Mathematica [A]  time = 0.150622, size = 175, normalized size = 1.2 $\frac{\frac{\sqrt{c} \left (a^2 e (B e+2 C d+C e x)-a c \left (A e (2 d+e x)+B d (d+2 e x)+C d^2 x\right )+A c^2 d^2 x\right )}{a \left (a+c x^2\right )}+\frac{\tan ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a}}\right ) \left (A c \left (a e^2+c d^2\right )+a \left (c d (2 B e+C d)-3 a C e^2\right )\right )}{a^{3/2}}+\sqrt{c} e \log \left (a+c x^2\right ) (B e+2 C d)+2 \sqrt{c} C e^2 x}{2 c^{5/2}}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(2*Sqrt[c]*C*e^2*x + (Sqrt[c]*(A*c^2*d^2*x + a^2*e*(2*C*d + B*e + C*e*x) - a*c*(C*d^2*x + A*e*(2*d + e*x) + B*
d*(d + 2*e*x))))/(a*(a + c*x^2)) + ((A*c*(c*d^2 + a*e^2) + a*(-3*a*C*e^2 + c*d*(C*d + 2*B*e)))*ArcTan[(Sqrt[c]
*x)/Sqrt[a]])/a^(3/2) + Sqrt[c]*e*(2*C*d + B*e)*Log[a + c*x^2])/(2*c^(5/2))

________________________________________________________________________________________

Maple [B]  time = 0.051, size = 323, normalized size = 2.2 \begin{align*}{\frac{C{e}^{2}x}{{c}^{2}}}-{\frac{A{e}^{2}x}{2\,c \left ( c{x}^{2}+a \right ) }}+{\frac{xA{d}^{2}}{ \left ( 2\,c{x}^{2}+2\,a \right ) a}}-{\frac{Bdex}{c \left ( c{x}^{2}+a \right ) }}+{\frac{aC{e}^{2}x}{2\,{c}^{2} \left ( c{x}^{2}+a \right ) }}-{\frac{C{d}^{2}x}{2\,c \left ( c{x}^{2}+a \right ) }}-{\frac{Ade}{c \left ( c{x}^{2}+a \right ) }}+{\frac{aB{e}^{2}}{2\,{c}^{2} \left ( c{x}^{2}+a \right ) }}-{\frac{B{d}^{2}}{2\,c \left ( c{x}^{2}+a \right ) }}+{\frac{Cade}{{c}^{2} \left ( c{x}^{2}+a \right ) }}+{\frac{\ln \left ( c{x}^{2}+a \right ) B{e}^{2}}{2\,{c}^{2}}}+{\frac{\ln \left ( c{x}^{2}+a \right ) Cde}{{c}^{2}}}+{\frac{A{e}^{2}}{2\,c}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}+{\frac{A{d}^{2}}{2\,a}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}+{\frac{Bde}{c}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}-{\frac{3\,aC{e}^{2}}{2\,{c}^{2}}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}+{\frac{C{d}^{2}}{2\,c}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}} \end{align*}

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

[In]

int((e*x+d)^2*(C*x^2+B*x+A)/(c*x^2+a)^2,x)

[Out]

C*e^2/c^2*x-1/2/c/(c*x^2+a)*A*e^2*x+1/2/(c*x^2+a)*x/a*A*d^2-1/c/(c*x^2+a)*B*d*e*x+1/2/c^2/(c*x^2+a)*a*C*e^2*x-
1/2/c/(c*x^2+a)*C*d^2*x-1/c/(c*x^2+a)*A*d*e+1/2/c^2/(c*x^2+a)*a*B*e^2-1/2/c/(c*x^2+a)*B*d^2+1/c^2/(c*x^2+a)*C*
a*d*e+1/2/c^2*ln(c*x^2+a)*B*e^2+1/c^2*ln(c*x^2+a)*C*d*e+1/2/c/(a*c)^(1/2)*arctan(x*c/(a*c)^(1/2))*A*e^2+1/2/a/
(a*c)^(1/2)*arctan(x*c/(a*c)^(1/2))*A*d^2+1/c/(a*c)^(1/2)*arctan(x*c/(a*c)^(1/2))*B*d*e-3/2/c^2*a/(a*c)^(1/2)*
arctan(x*c/(a*c)^(1/2))*C*e^2+1/2/c/(a*c)^(1/2)*arctan(x*c/(a*c)^(1/2))*C*d^2

________________________________________________________________________________________

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*(C*x^2+B*x+A)/(c*x^2+a)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.1014, size = 1276, normalized size = 8.74 \begin{align*} \left [\frac{4 \, C a^{2} c^{2} e^{2} x^{3} - 2 \, B a^{2} c^{2} d^{2} + 2 \, B a^{3} c e^{2} + 4 \,{\left (C a^{3} c - A a^{2} c^{2}\right )} d e -{\left (2 \, B a^{2} c d e +{\left (C a^{2} c + A a c^{2}\right )} d^{2} -{\left (3 \, C a^{3} - A a^{2} c\right )} e^{2} +{\left (2 \, B a c^{2} d e +{\left (C a c^{2} + A c^{3}\right )} d^{2} -{\left (3 \, C a^{2} c - A a c^{2}\right )} e^{2}\right )} x^{2}\right )} \sqrt{-a c} \log \left (\frac{c x^{2} - 2 \, \sqrt{-a c} x - a}{c x^{2} + a}\right ) - 2 \,{\left (2 \, B a^{2} c^{2} d e +{\left (C a^{2} c^{2} - A a c^{3}\right )} d^{2} -{\left (3 \, C a^{3} c - A a^{2} c^{2}\right )} e^{2}\right )} x + 2 \,{\left (2 \, C a^{3} c d e + B a^{3} c e^{2} +{\left (2 \, C a^{2} c^{2} d e + B a^{2} c^{2} e^{2}\right )} x^{2}\right )} \log \left (c x^{2} + a\right )}{4 \,{\left (a^{2} c^{4} x^{2} + a^{3} c^{3}\right )}}, \frac{2 \, C a^{2} c^{2} e^{2} x^{3} - B a^{2} c^{2} d^{2} + B a^{3} c e^{2} + 2 \,{\left (C a^{3} c - A a^{2} c^{2}\right )} d e +{\left (2 \, B a^{2} c d e +{\left (C a^{2} c + A a c^{2}\right )} d^{2} -{\left (3 \, C a^{3} - A a^{2} c\right )} e^{2} +{\left (2 \, B a c^{2} d e +{\left (C a c^{2} + A c^{3}\right )} d^{2} -{\left (3 \, C a^{2} c - A a c^{2}\right )} e^{2}\right )} x^{2}\right )} \sqrt{a c} \arctan \left (\frac{\sqrt{a c} x}{a}\right ) -{\left (2 \, B a^{2} c^{2} d e +{\left (C a^{2} c^{2} - A a c^{3}\right )} d^{2} -{\left (3 \, C a^{3} c - A a^{2} c^{2}\right )} e^{2}\right )} x +{\left (2 \, C a^{3} c d e + B a^{3} c e^{2} +{\left (2 \, C a^{2} c^{2} d e + B a^{2} c^{2} e^{2}\right )} x^{2}\right )} \log \left (c x^{2} + a\right )}{2 \,{\left (a^{2} c^{4} x^{2} + a^{3} c^{3}\right )}}\right ] \end{align*}

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

[In]

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

[Out]

[1/4*(4*C*a^2*c^2*e^2*x^3 - 2*B*a^2*c^2*d^2 + 2*B*a^3*c*e^2 + 4*(C*a^3*c - A*a^2*c^2)*d*e - (2*B*a^2*c*d*e + (
C*a^2*c + A*a*c^2)*d^2 - (3*C*a^3 - A*a^2*c)*e^2 + (2*B*a*c^2*d*e + (C*a*c^2 + A*c^3)*d^2 - (3*C*a^2*c - A*a*c
^2)*e^2)*x^2)*sqrt(-a*c)*log((c*x^2 - 2*sqrt(-a*c)*x - a)/(c*x^2 + a)) - 2*(2*B*a^2*c^2*d*e + (C*a^2*c^2 - A*a
*c^3)*d^2 - (3*C*a^3*c - A*a^2*c^2)*e^2)*x + 2*(2*C*a^3*c*d*e + B*a^3*c*e^2 + (2*C*a^2*c^2*d*e + B*a^2*c^2*e^2
)*x^2)*log(c*x^2 + a))/(a^2*c^4*x^2 + a^3*c^3), 1/2*(2*C*a^2*c^2*e^2*x^3 - B*a^2*c^2*d^2 + B*a^3*c*e^2 + 2*(C*
a^3*c - A*a^2*c^2)*d*e + (2*B*a^2*c*d*e + (C*a^2*c + A*a*c^2)*d^2 - (3*C*a^3 - A*a^2*c)*e^2 + (2*B*a*c^2*d*e +
(C*a*c^2 + A*c^3)*d^2 - (3*C*a^2*c - A*a*c^2)*e^2)*x^2)*sqrt(a*c)*arctan(sqrt(a*c)*x/a) - (2*B*a^2*c^2*d*e +
(C*a^2*c^2 - A*a*c^3)*d^2 - (3*C*a^3*c - A*a^2*c^2)*e^2)*x + (2*C*a^3*c*d*e + B*a^3*c*e^2 + (2*C*a^2*c^2*d*e +
B*a^2*c^2*e^2)*x^2)*log(c*x^2 + a))/(a^2*c^4*x^2 + a^3*c^3)]

________________________________________________________________________________________

Sympy [B]  time = 19.2175, size = 593, normalized size = 4.06 \begin{align*} \frac{C e^{2} x}{c^{2}} + \left (\frac{e \left (B e + 2 C d\right )}{2 c^{2}} - \frac{\sqrt{- a^{3} c^{5}} \left (- A a c e^{2} - A c^{2} d^{2} - 2 B a c d e + 3 C a^{2} e^{2} - C a c d^{2}\right )}{4 a^{3} c^{5}}\right ) \log{\left (x + \frac{2 B a^{2} e^{2} + 4 C a^{2} d e - 4 a^{2} c^{2} \left (\frac{e \left (B e + 2 C d\right )}{2 c^{2}} - \frac{\sqrt{- a^{3} c^{5}} \left (- A a c e^{2} - A c^{2} d^{2} - 2 B a c d e + 3 C a^{2} e^{2} - C a c d^{2}\right )}{4 a^{3} c^{5}}\right )}{- A a c e^{2} - A c^{2} d^{2} - 2 B a c d e + 3 C a^{2} e^{2} - C a c d^{2}} \right )} + \left (\frac{e \left (B e + 2 C d\right )}{2 c^{2}} + \frac{\sqrt{- a^{3} c^{5}} \left (- A a c e^{2} - A c^{2} d^{2} - 2 B a c d e + 3 C a^{2} e^{2} - C a c d^{2}\right )}{4 a^{3} c^{5}}\right ) \log{\left (x + \frac{2 B a^{2} e^{2} + 4 C a^{2} d e - 4 a^{2} c^{2} \left (\frac{e \left (B e + 2 C d\right )}{2 c^{2}} + \frac{\sqrt{- a^{3} c^{5}} \left (- A a c e^{2} - A c^{2} d^{2} - 2 B a c d e + 3 C a^{2} e^{2} - C a c d^{2}\right )}{4 a^{3} c^{5}}\right )}{- A a c e^{2} - A c^{2} d^{2} - 2 B a c d e + 3 C a^{2} e^{2} - C a c d^{2}} \right )} + \frac{- 2 A a c d e + B a^{2} e^{2} - B a c d^{2} + 2 C a^{2} d e + x \left (- A a c e^{2} + A c^{2} d^{2} - 2 B a c d e + C a^{2} e^{2} - C a c d^{2}\right )}{2 a^{2} c^{2} + 2 a c^{3} x^{2}} \end{align*}

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

[In]

integrate((e*x+d)**2*(C*x**2+B*x+A)/(c*x**2+a)**2,x)

[Out]

C*e**2*x/c**2 + (e*(B*e + 2*C*d)/(2*c**2) - sqrt(-a**3*c**5)*(-A*a*c*e**2 - A*c**2*d**2 - 2*B*a*c*d*e + 3*C*a*
*2*e**2 - C*a*c*d**2)/(4*a**3*c**5))*log(x + (2*B*a**2*e**2 + 4*C*a**2*d*e - 4*a**2*c**2*(e*(B*e + 2*C*d)/(2*c
**2) - sqrt(-a**3*c**5)*(-A*a*c*e**2 - A*c**2*d**2 - 2*B*a*c*d*e + 3*C*a**2*e**2 - C*a*c*d**2)/(4*a**3*c**5)))
/(-A*a*c*e**2 - A*c**2*d**2 - 2*B*a*c*d*e + 3*C*a**2*e**2 - C*a*c*d**2)) + (e*(B*e + 2*C*d)/(2*c**2) + sqrt(-a
**3*c**5)*(-A*a*c*e**2 - A*c**2*d**2 - 2*B*a*c*d*e + 3*C*a**2*e**2 - C*a*c*d**2)/(4*a**3*c**5))*log(x + (2*B*a
**2*e**2 + 4*C*a**2*d*e - 4*a**2*c**2*(e*(B*e + 2*C*d)/(2*c**2) + sqrt(-a**3*c**5)*(-A*a*c*e**2 - A*c**2*d**2
- 2*B*a*c*d*e + 3*C*a**2*e**2 - C*a*c*d**2)/(4*a**3*c**5)))/(-A*a*c*e**2 - A*c**2*d**2 - 2*B*a*c*d*e + 3*C*a**
2*e**2 - C*a*c*d**2)) + (-2*A*a*c*d*e + B*a**2*e**2 - B*a*c*d**2 + 2*C*a**2*d*e + x*(-A*a*c*e**2 + A*c**2*d**2
- 2*B*a*c*d*e + C*a**2*e**2 - C*a*c*d**2))/(2*a**2*c**2 + 2*a*c**3*x**2)

________________________________________________________________________________________

Giac [A]  time = 1.16413, size = 248, normalized size = 1.7 \begin{align*} \frac{C x e^{2}}{c^{2}} + \frac{{\left (2 \, C d e + B e^{2}\right )} \log \left (c x^{2} + a\right )}{2 \, c^{2}} + \frac{{\left (C a c d^{2} + A c^{2} d^{2} + 2 \, B a c d e - 3 \, C a^{2} e^{2} + A a c e^{2}\right )} \arctan \left (\frac{c x}{\sqrt{a c}}\right )}{2 \, \sqrt{a c} a c^{2}} - \frac{B a c d^{2} - 2 \, C a^{2} d e + 2 \, A a c d e - B a^{2} e^{2} +{\left (C a c d^{2} - A c^{2} d^{2} + 2 \, B a c d e - C a^{2} e^{2} + A a c e^{2}\right )} x}{2 \,{\left (c x^{2} + a\right )} a c^{2}} \end{align*}

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

[In]

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

[Out]

C*x*e^2/c^2 + 1/2*(2*C*d*e + B*e^2)*log(c*x^2 + a)/c^2 + 1/2*(C*a*c*d^2 + A*c^2*d^2 + 2*B*a*c*d*e - 3*C*a^2*e^
2 + A*a*c*e^2)*arctan(c*x/sqrt(a*c))/(sqrt(a*c)*a*c^2) - 1/2*(B*a*c*d^2 - 2*C*a^2*d*e + 2*A*a*c*d*e - B*a^2*e^
2 + (C*a*c*d^2 - A*c^2*d^2 + 2*B*a*c*d*e - C*a^2*e^2 + A*a*c*e^2)*x)/((c*x^2 + a)*a*c^2)