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

Optimal result
Mathematica [B] (warning: unable to verify)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F(-1)]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 29, antiderivative size = 247 \[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=-\frac {e^2}{c x}-\frac {\left (e (2 c d-b e)+\frac {2 c^2 d^2+b^2 e^2-2 c e (b d+a e)}{\sqrt {b^2-4 a c}}\right ) \operatorname {Hypergeometric2F1}\left (1,-\frac {1}{n},-\frac {1-n}{n},-\frac {2 c x^n}{b-\sqrt {b^2-4 a c}}\right )}{c \left (b-\sqrt {b^2-4 a c}\right ) x}-\frac {\left (e (2 c d-b e)-\frac {2 c^2 d^2+b^2 e^2-2 c e (b d+a e)}{\sqrt {b^2-4 a c}}\right ) \operatorname {Hypergeometric2F1}\left (1,-\frac {1}{n},-\frac {1-n}{n},-\frac {2 c x^n}{b+\sqrt {b^2-4 a c}}\right )}{c \left (b+\sqrt {b^2-4 a c}\right ) x} \] Output:

-e^2/c/x-(e*(-b*e+2*c*d)+(2*c^2*d^2+b^2*e^2-2*c*e*(a*e+b*d))/(-4*a*c+b^2)^ 
(1/2))*hypergeom([1, -1/n],[-(1-n)/n],-2*c*x^n/(b-(-4*a*c+b^2)^(1/2)))/c/( 
b-(-4*a*c+b^2)^(1/2))/x-(e*(-b*e+2*c*d)-(2*c^2*d^2+b^2*e^2-2*c*e*(a*e+b*d) 
)/(-4*a*c+b^2)^(1/2))*hypergeom([1, -1/n],[-(1-n)/n],-2*c*x^n/(b+(-4*a*c+b 
^2)^(1/2)))/c/(b+(-4*a*c+b^2)^(1/2))/x
 

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(546\) vs. \(2(247)=494\).

Time = 2.25 (sec) , antiderivative size = 546, normalized size of antiderivative = 2.21 \[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\frac {-\frac {2^{1+\frac {1}{n}} \left (c d^2-a e^2\right ) \left (\frac {c x^n}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )^{\frac {1}{n}} \operatorname {Hypergeometric2F1}\left (1+\frac {1}{n},1+\frac {1}{n},2+\frac {1}{n},\frac {b-\sqrt {b^2-4 a c}}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )}{(1+n) \left (-b^2+4 a c+b \sqrt {b^2-4 a c}+2 c \sqrt {b^2-4 a c} x^n\right )}+\frac {2^{1+\frac {1}{n}} \left (c d^2-a e^2\right ) \left (\frac {c x^n}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )^{\frac {1}{n}} \operatorname {Hypergeometric2F1}\left (1+\frac {1}{n},1+\frac {1}{n},2+\frac {1}{n},\frac {b+\sqrt {b^2-4 a c}}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )}{(1+n) \left (b^2-4 a c+b \sqrt {b^2-4 a c}+2 c \sqrt {b^2-4 a c} x^n\right )}-\frac {e \left (\sqrt {b^2-4 a c} e+2^{\frac {1}{n}} (2 c d-b e) \left (\frac {c x^n}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )^{\frac {1}{n}} \operatorname {Hypergeometric2F1}\left (\frac {1}{n},\frac {1}{n},1+\frac {1}{n},\frac {b-\sqrt {b^2-4 a c}}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )-2^{\frac {1}{n}} (2 c d-b e) \left (\frac {c x^n}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )^{\frac {1}{n}} \operatorname {Hypergeometric2F1}\left (\frac {1}{n},\frac {1}{n},1+\frac {1}{n},\frac {b+\sqrt {b^2-4 a c}}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )\right )}{c \sqrt {b^2-4 a c}}}{x} \] Input:

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

Output:

(-((2^(1 + n^(-1))*(c*d^2 - a*e^2)*((c*x^n)/(b - Sqrt[b^2 - 4*a*c] + 2*c*x 
^n))^n^(-1)*Hypergeometric2F1[1 + n^(-1), 1 + n^(-1), 2 + n^(-1), (b - Sqr 
t[b^2 - 4*a*c])/(b - Sqrt[b^2 - 4*a*c] + 2*c*x^n)])/((1 + n)*(-b^2 + 4*a*c 
 + b*Sqrt[b^2 - 4*a*c] + 2*c*Sqrt[b^2 - 4*a*c]*x^n))) + (2^(1 + n^(-1))*(c 
*d^2 - a*e^2)*((c*x^n)/(b + Sqrt[b^2 - 4*a*c] + 2*c*x^n))^n^(-1)*Hypergeom 
etric2F1[1 + n^(-1), 1 + n^(-1), 2 + n^(-1), (b + Sqrt[b^2 - 4*a*c])/(b + 
Sqrt[b^2 - 4*a*c] + 2*c*x^n)])/((1 + n)*(b^2 - 4*a*c + b*Sqrt[b^2 - 4*a*c] 
 + 2*c*Sqrt[b^2 - 4*a*c]*x^n)) - (e*(Sqrt[b^2 - 4*a*c]*e + 2^n^(-1)*(2*c*d 
 - b*e)*((c*x^n)/(b - Sqrt[b^2 - 4*a*c] + 2*c*x^n))^n^(-1)*Hypergeometric2 
F1[n^(-1), n^(-1), 1 + n^(-1), (b - Sqrt[b^2 - 4*a*c])/(b - Sqrt[b^2 - 4*a 
*c] + 2*c*x^n)] - 2^n^(-1)*(2*c*d - b*e)*((c*x^n)/(b + Sqrt[b^2 - 4*a*c] + 
 2*c*x^n))^n^(-1)*Hypergeometric2F1[n^(-1), n^(-1), 1 + n^(-1), (b + Sqrt[ 
b^2 - 4*a*c])/(b + Sqrt[b^2 - 4*a*c] + 2*c*x^n)]))/(c*Sqrt[b^2 - 4*a*c]))/ 
x
 

Rubi [A] (verified)

Time = 0.87 (sec) , antiderivative size = 447, normalized size of antiderivative = 1.81, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {1880, 1008, 959, 888}

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

\(\Big \downarrow \) 1880

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

\(\Big \downarrow \) 1008

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

\(\Big \downarrow \) 959

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

\(\Big \downarrow \) 888

\(\displaystyle \frac {2 c \left (-\frac {\frac {(1-n) \left (-2 c e \left (-d \sqrt {b^2-4 a c}+a e+b d\right )+b e^2 \left (b-\sqrt {b^2-4 a c}\right )+2 c^2 d^2\right ) \operatorname {Hypergeometric2F1}\left (1,-\frac {1}{n},-\frac {1-n}{n},-\frac {2 c x^n}{b-\sqrt {b^2-4 a c}}\right )}{c x \left (b-\sqrt {b^2-4 a c}\right )}+\frac {e \left (2 c d (1-2 n)-e (1-n) \left (b-\sqrt {b^2-4 a c}\right )\right )}{2 c x}}{2 c (1-n)}-\frac {e \left (d+e x^n\right )}{2 c (1-n) x}\right )}{\sqrt {b^2-4 a c}}-\frac {2 c \left (-\frac {\frac {(1-n) \left (-2 c e \left (d \sqrt {b^2-4 a c}+a e+b d\right )+b e^2 \left (\sqrt {b^2-4 a c}+b\right )+2 c^2 d^2\right ) \operatorname {Hypergeometric2F1}\left (1,-\frac {1}{n},-\frac {1-n}{n},-\frac {2 c x^n}{b+\sqrt {b^2-4 a c}}\right )}{c x \left (\sqrt {b^2-4 a c}+b\right )}+\frac {e \left (c d (2-4 n)-e (1-n) \left (\sqrt {b^2-4 a c}+b\right )\right )}{2 c x}}{2 c (1-n)}-\frac {e \left (d+e x^n\right )}{2 c (1-n) x}\right )}{\sqrt {b^2-4 a c}}\)

Input:

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

Output:

(2*c*(-1/2*(e*(d + e*x^n))/(c*(1 - n)*x) - ((e*(2*c*d*(1 - 2*n) - (b - Sqr 
t[b^2 - 4*a*c])*e*(1 - n)))/(2*c*x) + ((2*c^2*d^2 + b*(b - Sqrt[b^2 - 4*a* 
c])*e^2 - 2*c*e*(b*d - Sqrt[b^2 - 4*a*c]*d + a*e))*(1 - n)*Hypergeometric2 
F1[1, -n^(-1), -((1 - n)/n), (-2*c*x^n)/(b - Sqrt[b^2 - 4*a*c])])/(c*(b - 
Sqrt[b^2 - 4*a*c])*x))/(2*c*(1 - n))))/Sqrt[b^2 - 4*a*c] - (2*c*(-1/2*(e*( 
d + e*x^n))/(c*(1 - n)*x) - ((e*(c*d*(2 - 4*n) - (b + Sqrt[b^2 - 4*a*c])*e 
*(1 - n)))/(2*c*x) + ((2*c^2*d^2 + b*(b + Sqrt[b^2 - 4*a*c])*e^2 - 2*c*e*( 
b*d + Sqrt[b^2 - 4*a*c]*d + a*e))*(1 - n)*Hypergeometric2F1[1, -n^(-1), -( 
(1 - n)/n), (-2*c*x^n)/(b + Sqrt[b^2 - 4*a*c])])/(c*(b + Sqrt[b^2 - 4*a*c] 
)*x))/(2*c*(1 - n))))/Sqrt[b^2 - 4*a*c]
 

Defintions of rubi rules used

rule 888
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p 
*((c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/n, (m + 1)/n + 1 
, (-b)*(x^n/a)], x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] && (ILt 
Q[p, 0] || GtQ[a, 0])
 

rule 959
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n 
_)), x_Symbol] :> Simp[d*(e*x)^(m + 1)*((a + b*x^n)^(p + 1)/(b*e*(m + n*(p 
+ 1) + 1))), x] - Simp[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(b*(m + n*(p 
 + 1) + 1))   Int[(e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, 
 n, p}, x] && NeQ[b*c - a*d, 0] && NeQ[m + n*(p + 1) + 1, 0]
 

rule 1008
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_ 
))^(q_), x_Symbol] :> Simp[d*(e*x)^(m + 1)*(a + b*x^n)^(p + 1)*((c + d*x^n) 
^(q - 1)/(b*e*(m + n*(p + q) + 1))), x] + Simp[1/(b*(m + n*(p + q) + 1)) 
Int[(e*x)^m*(a + b*x^n)^p*(c + d*x^n)^(q - 2)*Simp[c*((c*b - a*d)*(m + 1) + 
 c*b*n*(p + q)) + (d*(c*b - a*d)*(m + 1) + d*n*(q - 1)*(b*c - a*d) + c*b*d* 
n*(p + q))*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x] && NeQ[b*c 
 - a*d, 0] && GtQ[q, 1] && IntBinomialQ[a, b, c, d, e, m, n, p, q, x]
 

rule 1880
Int[(((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_)^(n_))^(q_))/((a_) + (c_.)*(x_)^( 
n2_.) + (b_.)*(x_)^(n_)), x_Symbol] :> With[{r = Rt[b^2 - 4*a*c, 2]}, Simp[ 
2*(c/r)   Int[(f*x)^m*((d + e*x^n)^q/(b - r + 2*c*x^n)), x], x] - Simp[2*(c 
/r)   Int[(f*x)^m*((d + e*x^n)^q/(b + r + 2*c*x^n)), x], x]] /; FreeQ[{a, b 
, c, d, e, f, m, n, q}, x] && EqQ[n2, 2*n] && NeQ[b^2 - 4*a*c, 0] &&  !Rati 
onalQ[n]
 
Maple [F]

\[\int \frac {\left (d +e \,x^{n}\right )^{2}}{x^{2} \left (a +b \,x^{n}+c \,x^{2 n}\right )}d x\]

Input:

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

Output:

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

Fricas [F]

\[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\int { \frac {{\left (e x^{n} + d\right )}^{2}}{{\left (c x^{2 \, n} + b x^{n} + a\right )} x^{2}} \,d x } \] Input:

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

Output:

integral((e^2*x^(2*n) + 2*d*e*x^n + d^2)/(c*x^2*x^(2*n) + b*x^2*x^n + a*x^ 
2), x)
 

Sympy [F(-1)]

Timed out. \[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\text {Timed out} \] Input:

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

Output:

Timed out
 

Maxima [F]

\[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\int { \frac {{\left (e x^{n} + d\right )}^{2}}{{\left (c x^{2 \, n} + b x^{n} + a\right )} x^{2}} \,d x } \] Input:

integrate((d+e*x^n)^2/x^2/(a+b*x^n+c*x^(2*n)),x, algorithm="maxima")
 

Output:

-e^2/(c*x) - integrate(-(c*d^2 - a*e^2 + (2*c*d*e - b*e^2)*x^n)/(c^2*x^2*x 
^(2*n) + b*c*x^2*x^n + a*c*x^2), x)
 

Giac [F]

\[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\int { \frac {{\left (e x^{n} + d\right )}^{2}}{{\left (c x^{2 \, n} + b x^{n} + a\right )} x^{2}} \,d x } \] Input:

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

Output:

integrate((e*x^n + d)^2/((c*x^(2*n) + b*x^n + a)*x^2), x)
 

Mupad [F(-1)]

Timed out. \[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\int \frac {{\left (d+e\,x^n\right )}^2}{x^2\,\left (a+b\,x^n+c\,x^{2\,n}\right )} \,d x \] Input:

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

Output:

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

Reduce [F]

\[ \int \frac {\left (d+e x^n\right )^2}{x^2 \left (a+b x^n+c x^{2 n}\right )} \, dx=\frac {\left (\int \frac {x^{2 n}}{x^{2 n} c \,x^{2}+x^{n} b \,x^{2}+a \,x^{2}}d x \right ) b \,e^{2} x -2 \left (\int \frac {x^{2 n}}{x^{2 n} c \,x^{2}+x^{n} b \,x^{2}+a \,x^{2}}d x \right ) c d e x -2 \left (\int \frac {1}{x^{2 n} c \,x^{2}+x^{n} b \,x^{2}+a \,x^{2}}d x \right ) a d e x +\left (\int \frac {1}{x^{2 n} c \,x^{2}+x^{n} b \,x^{2}+a \,x^{2}}d x \right ) b \,d^{2} x -2 d e}{b x} \] Input:

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

Output:

(int(x**(2*n)/(x**(2*n)*c*x**2 + x**n*b*x**2 + a*x**2),x)*b*e**2*x - 2*int 
(x**(2*n)/(x**(2*n)*c*x**2 + x**n*b*x**2 + a*x**2),x)*c*d*e*x - 2*int(1/(x 
**(2*n)*c*x**2 + x**n*b*x**2 + a*x**2),x)*a*d*e*x + int(1/(x**(2*n)*c*x**2 
 + x**n*b*x**2 + a*x**2),x)*b*d**2*x - 2*d*e)/(b*x)