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

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

Optimal result

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

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

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(834\) vs. \(2(404)=808\).

Time = 1.57 (sec) , antiderivative size = 834, normalized size of antiderivative = 2.06 \[ \int \frac {d+e x+f x^2}{a+b x^n+c x^{2 n}} \, dx=\frac {x \left (2 f x^2 \left (\left (-b^2+4 a c-b \sqrt {b^2-4 a c}\right ) \left (1-\left (\frac {x^n}{-\frac {-b+\sqrt {b^2-4 a c}}{2 c}+x^n}\right )^{-3/n} \operatorname {Hypergeometric2F1}\left (-\frac {3}{n},-\frac {3}{n},\frac {-3+n}{n},\frac {b-\sqrt {b^2-4 a c}}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )\right )+\left (-b^2+4 a c+b \sqrt {b^2-4 a c}\right ) \left (1-8^{-1/n} \left (\frac {c x^n}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )^{-3/n} \operatorname {Hypergeometric2F1}\left (-\frac {3}{n},-\frac {3}{n},\frac {-3+n}{n},\frac {b+\sqrt {b^2-4 a c}}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )\right )\right )+3 e x \left (\left (-b^2+4 a c-b \sqrt {b^2-4 a c}\right ) \left (1-\left (\frac {x^n}{-\frac {-b+\sqrt {b^2-4 a c}}{2 c}+x^n}\right )^{-2/n} \operatorname {Hypergeometric2F1}\left (-\frac {2}{n},-\frac {2}{n},\frac {-2+n}{n},\frac {b-\sqrt {b^2-4 a c}}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )\right )+\left (-b^2+4 a c+b \sqrt {b^2-4 a c}\right ) \left (1-4^{-1/n} \left (\frac {c x^n}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )^{-2/n} \operatorname {Hypergeometric2F1}\left (-\frac {2}{n},-\frac {2}{n},\frac {-2+n}{n},\frac {b+\sqrt {b^2-4 a c}}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )\right )\right )+6 d \left (\left (-b^2+4 a c-b \sqrt {b^2-4 a c}\right ) \left (1-\left (\frac {x^n}{-\frac {-b+\sqrt {b^2-4 a c}}{2 c}+x^n}\right )^{-1/n} \operatorname {Hypergeometric2F1}\left (-\frac {1}{n},-\frac {1}{n},\frac {-1+n}{n},\frac {b-\sqrt {b^2-4 a c}}{b-\sqrt {b^2-4 a c}+2 c x^n}\right )\right )-2^{-1/n} \sqrt {b^2-4 a c} \left (-b+\sqrt {b^2-4 a c}\right ) \left (\frac {c x^n}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )^{-1/n} \left (2^{\frac {1}{n}} \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},\frac {-1+n}{n},\frac {b+\sqrt {b^2-4 a c}}{b+\sqrt {b^2-4 a c}+2 c x^n}\right )\right )\right )\right )}{12 a \left (-b^2+4 a c\right )} \] Input:

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

Output:

(x*(2*f*x^2*((-b^2 + 4*a*c - b*Sqrt[b^2 - 4*a*c])*(1 - Hypergeometric2F1[- 
3/n, -3/n, (-3 + n)/n, (b - Sqrt[b^2 - 4*a*c])/(b - Sqrt[b^2 - 4*a*c] + 2* 
c*x^n)]/(x^n/(-1/2*(-b + Sqrt[b^2 - 4*a*c])/c + x^n))^(3/n)) + (-b^2 + 4*a 
*c + b*Sqrt[b^2 - 4*a*c])*(1 - Hypergeometric2F1[-3/n, -3/n, (-3 + n)/n, ( 
b + Sqrt[b^2 - 4*a*c])/(b + Sqrt[b^2 - 4*a*c] + 2*c*x^n)]/(8^n^(-1)*((c*x^ 
n)/(b + Sqrt[b^2 - 4*a*c] + 2*c*x^n))^(3/n)))) + 3*e*x*((-b^2 + 4*a*c - b* 
Sqrt[b^2 - 4*a*c])*(1 - Hypergeometric2F1[-2/n, -2/n, (-2 + n)/n, (b - Sqr 
t[b^2 - 4*a*c])/(b - Sqrt[b^2 - 4*a*c] + 2*c*x^n)]/(x^n/(-1/2*(-b + Sqrt[b 
^2 - 4*a*c])/c + x^n))^(2/n)) + (-b^2 + 4*a*c + b*Sqrt[b^2 - 4*a*c])*(1 - 
Hypergeometric2F1[-2/n, -2/n, (-2 + n)/n, (b + Sqrt[b^2 - 4*a*c])/(b + Sqr 
t[b^2 - 4*a*c] + 2*c*x^n)]/(4^n^(-1)*((c*x^n)/(b + Sqrt[b^2 - 4*a*c] + 2*c 
*x^n))^(2/n)))) + 6*d*((-b^2 + 4*a*c - b*Sqrt[b^2 - 4*a*c])*(1 - Hypergeom 
etric2F1[-n^(-1), -n^(-1), (-1 + n)/n, (b - Sqrt[b^2 - 4*a*c])/(b - Sqrt[b 
^2 - 4*a*c] + 2*c*x^n)]/(x^n/(-1/2*(-b + Sqrt[b^2 - 4*a*c])/c + x^n))^n^(- 
1)) - (Sqrt[b^2 - 4*a*c]*(-b + Sqrt[b^2 - 4*a*c])*(2^n^(-1)*((c*x^n)/(b + 
Sqrt[b^2 - 4*a*c] + 2*c*x^n))^n^(-1) - Hypergeometric2F1[-n^(-1), -n^(-1), 
 (-1 + n)/n, (b + Sqrt[b^2 - 4*a*c])/(b + Sqrt[b^2 - 4*a*c] + 2*c*x^n)]))/ 
(2^n^(-1)*((c*x^n)/(b + Sqrt[b^2 - 4*a*c] + 2*c*x^n))^n^(-1)))))/(12*a*(-b 
^2 + 4*a*c))
 

Rubi [A] (verified)

Time = 0.59 (sec) , antiderivative size = 387, normalized size of antiderivative = 0.96, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {2325, 2432, 2009}

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

\(\Big \downarrow \) 2325

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

\(\Big \downarrow \) 2432

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

(2*c*((d*x*Hypergeometric2F1[1, n^(-1), 1 + n^(-1), (-2*c*x^n)/(b - Sqrt[b 
^2 - 4*a*c])])/(b - Sqrt[b^2 - 4*a*c]) + (e*x^2*Hypergeometric2F1[1, 2/n, 
(2 + n)/n, (-2*c*x^n)/(b - Sqrt[b^2 - 4*a*c])])/(2*(b - Sqrt[b^2 - 4*a*c]) 
) + (f*x^3*Hypergeometric2F1[1, 3/n, (3 + n)/n, (-2*c*x^n)/(b - Sqrt[b^2 - 
 4*a*c])])/(3*(b - Sqrt[b^2 - 4*a*c]))))/Sqrt[b^2 - 4*a*c] - (2*c*((d*x*Hy 
pergeometric2F1[1, n^(-1), 1 + n^(-1), (-2*c*x^n)/(b + Sqrt[b^2 - 4*a*c])] 
)/(b + Sqrt[b^2 - 4*a*c]) + (e*x^2*Hypergeometric2F1[1, 2/n, (2 + n)/n, (- 
2*c*x^n)/(b + Sqrt[b^2 - 4*a*c])])/(2*(b + Sqrt[b^2 - 4*a*c])) + (f*x^3*Hy 
pergeometric2F1[1, 3/n, (3 + n)/n, (-2*c*x^n)/(b + Sqrt[b^2 - 4*a*c])])/(3 
*(b + Sqrt[b^2 - 4*a*c]))))/Sqrt[b^2 - 4*a*c]
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2325
Int[(Pq_)/((a_) + (b_.)*(x_)^(n_.) + (c_.)*(x_)^(n2_.)), x_Symbol] :> With[ 
{q = Rt[b^2 - 4*a*c, 2]}, Simp[2*(c/q)   Int[Pq/(b - q + 2*c*x^n), x], x] - 
 Simp[2*(c/q)   Int[Pq/(b + q + 2*c*x^n), x], x]] /; FreeQ[{a, b, c, n}, x] 
 && EqQ[n2, 2*n] && PolyQ[Pq, x] && NeQ[b^2 - 4*a*c, 0]
 

rule 2432
Int[(Pq_)*((a_) + (b_.)*(x_)^(n_))^(p_.), x_Symbol] :> Int[ExpandIntegrand[ 
Pq*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, n, p}, x] && (PolyQ[Pq, x] || Poly 
Q[Pq, x^n])
 
Maple [F]

\[\int \frac {f \,x^{2}+e x +d}{a +b \,x^{n}+c \,x^{2 n}}d x\]

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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