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

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

[Out]

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

________________________________________________________________________________________

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

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 1629

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

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

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

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.069, size = 256, normalized size = 1.5 \begin{align*}{\frac{C{e}^{2}{x}^{3}}{3\,c}}+{\frac{B{x}^{2}{e}^{2}}{2\,c}}+{\frac{C{x}^{2}de}{c}}+{\frac{A{e}^{2}x}{c}}+2\,{\frac{Bdex}{c}}-{\frac{aC{e}^{2}x}{{c}^{2}}}+{\frac{C{d}^{2}x}{c}}+{\frac{\ln \left ( c{x}^{2}+a \right ) Ade}{c}}-{\frac{\ln \left ( c{x}^{2}+a \right ) Ba{e}^{2}}{2\,{c}^{2}}}+{\frac{\ln \left ( c{x}^{2}+a \right ) B{d}^{2}}{2\,c}}-{\frac{\ln \left ( c{x}^{2}+a \right ) Cade}{{c}^{2}}}-{\frac{Aa{e}^{2}}{c}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}+{A{d}^{2}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}-2\,{\frac{aBde}{c\sqrt{ac}}\arctan \left ({\frac{cx}{\sqrt{ac}}} \right ) }+{\frac{{a}^{2}C{e}^{2}}{{c}^{2}}\arctan \left ({cx{\frac{1}{\sqrt{ac}}}} \right ){\frac{1}{\sqrt{ac}}}}-{\frac{aC{d}^{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),x)

[Out]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.8533, size = 855, normalized size = 5.09 \begin{align*} \left [\frac{2 \, C a c^{2} e^{2} x^{3} + 3 \,{\left (2 \, C a c^{2} d e + B a c^{2} e^{2}\right )} x^{2} - 3 \,{\left (2 \, B a c d e +{\left (C a c - A c^{2}\right )} d^{2} -{\left (C a^{2} - A a c\right )} e^{2}\right )} \sqrt{-a c} \log \left (\frac{c x^{2} + 2 \, \sqrt{-a c} x - a}{c x^{2} + a}\right ) + 6 \,{\left (C a c^{2} d^{2} + 2 \, B a c^{2} d e -{\left (C a^{2} c - A a c^{2}\right )} e^{2}\right )} x + 3 \,{\left (B a c^{2} d^{2} - B a^{2} c e^{2} - 2 \,{\left (C a^{2} c - A a c^{2}\right )} d e\right )} \log \left (c x^{2} + a\right )}{6 \, a c^{3}}, \frac{2 \, C a c^{2} e^{2} x^{3} + 3 \,{\left (2 \, C a c^{2} d e + B a c^{2} e^{2}\right )} x^{2} - 6 \,{\left (2 \, B a c d e +{\left (C a c - A c^{2}\right )} d^{2} -{\left (C a^{2} - A a c\right )} e^{2}\right )} \sqrt{a c} \arctan \left (\frac{\sqrt{a c} x}{a}\right ) + 6 \,{\left (C a c^{2} d^{2} + 2 \, B a c^{2} d e -{\left (C a^{2} c - A a c^{2}\right )} e^{2}\right )} x + 3 \,{\left (B a c^{2} d^{2} - B a^{2} c e^{2} - 2 \,{\left (C a^{2} c - A a c^{2}\right )} d e\right )} \log \left (c x^{2} + a\right )}{6 \, a c^{3}}\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),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [B]  time = 4.46252, size = 638, normalized size = 3.8 \begin{align*} \frac{C e^{2} x^{3}}{3 c} + \left (- \frac{- 2 A c d e + B a e^{2} - B c d^{2} + 2 C a d e}{2 c^{2}} - \frac{\sqrt{- a c^{5}} \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 c^{5}}\right ) \log{\left (x + \frac{- 2 A a c d e + B a^{2} e^{2} - B a c d^{2} + 2 C a^{2} d e + 2 a c^{2} \left (- \frac{- 2 A c d e + B a e^{2} - B c d^{2} + 2 C a d e}{2 c^{2}} - \frac{\sqrt{- a c^{5}} \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 c^{5}}\right )}{- 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 )} + \left (- \frac{- 2 A c d e + B a e^{2} - B c d^{2} + 2 C a d e}{2 c^{2}} + \frac{\sqrt{- a c^{5}} \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 c^{5}}\right ) \log{\left (x + \frac{- 2 A a c d e + B a^{2} e^{2} - B a c d^{2} + 2 C a^{2} d e + 2 a c^{2} \left (- \frac{- 2 A c d e + B a e^{2} - B c d^{2} + 2 C a d e}{2 c^{2}} + \frac{\sqrt{- a c^{5}} \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 c^{5}}\right )}{- 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 )} + \frac{x^{2} \left (B e^{2} + 2 C d e\right )}{2 c} - \frac{x \left (- A c e^{2} - 2 B c d e + C a e^{2} - C c d^{2}\right )}{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),x)

[Out]

C*e**2*x**3/(3*c) + (-(-2*A*c*d*e + B*a*e**2 - B*c*d**2 + 2*C*a*d*e)/(2*c**2) - sqrt(-a*c**5)*(-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*c**5))*log(x + (-2*A*a*c*d*e + B*a**2*e**2 - B*a*c*d
**2 + 2*C*a**2*d*e + 2*a*c**2*(-(-2*A*c*d*e + B*a*e**2 - B*c*d**2 + 2*C*a*d*e)/(2*c**2) - sqrt(-a*c**5)*(-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*c**5)))/(-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*c*d*e + B*a*e**2 - B*c*d**2 + 2*C*a*d*e)/(2*c**2) + sqrt(-a*c**5
)*(-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*c**5))*log(x + (-2*A*a*c*d*e + B*a
**2*e**2 - B*a*c*d**2 + 2*C*a**2*d*e + 2*a*c**2*(-(-2*A*c*d*e + B*a*e**2 - B*c*d**2 + 2*C*a*d*e)/(2*c**2) + sq
rt(-a*c**5)*(-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*c**5)))/(-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)) + x**2*(B*e**2 + 2*C*d*e)/(2*c) - x*(-A*c*e**2 - 2*B*c*d
*e + C*a*e**2 - C*c*d**2)/c**2

________________________________________________________________________________________

Giac [A]  time = 1.1366, size = 238, normalized size = 1.42 \begin{align*} \frac{{\left (B c d^{2} - 2 \, C a d e + 2 \, A c d e - B a 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 - C a^{2} e^{2} + A a c e^{2}\right )} \arctan \left (\frac{c x}{\sqrt{a c}}\right )}{\sqrt{a c} c^{2}} + \frac{2 \, C c^{2} x^{3} e^{2} + 6 \, C c^{2} d x^{2} e + 6 \, C c^{2} d^{2} x + 3 \, B c^{2} x^{2} e^{2} + 12 \, B c^{2} d x e - 6 \, C a c x e^{2} + 6 \, A c^{2} x e^{2}}{6 \, c^{3}} \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),x, algorithm="giac")

[Out]

1/2*(B*c*d^2 - 2*C*a*d*e + 2*A*c*d*e - B*a*e^2)*log(c*x^2 + a)/c^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)*arctan(c*x/sqrt(a*c))/(sqrt(a*c)*c^2) + 1/6*(2*C*c^2*x^3*e^2 + 6*C*c^2*d*x^2*e + 6*C*c^2*
d^2*x + 3*B*c^2*x^2*e^2 + 12*B*c^2*d*x*e - 6*C*a*c*x*e^2 + 6*A*c^2*x*e^2)/c^3