\(\int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx\) [9333]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 55, antiderivative size = 31 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=\frac {2}{\left (1+\frac {2-x}{\frac {2}{x}-x}\right ) x^2}-\log (x) \]

[Out]

2/x^2/((2-x)/(2/x-x)+1)-ln(x)

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.073, Rules used = {2099, 652, 632, 212} \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=\frac {3-2 x}{-x^2+x+1}+\frac {2}{x^2}-\frac {2}{x}-\log (x) \]

[In]

Int[(-4 - 6*x + 7*x^2 - x^3 - x^4 + 2*x^5 - x^6)/(x^3 + 2*x^4 - x^5 - 2*x^6 + x^7),x]

[Out]

2/x^2 - 2/x + (3 - 2*x)/(1 + x - x^2) - Log[x]

Rule 212

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] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 652

Int[((d_.) + (e_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((b*d - 2*a*e + (2*c*d -
b*e)*x)/((p + 1)*(b^2 - 4*a*c)))*(a + b*x + c*x^2)^(p + 1), x] - Dist[(2*p + 3)*((2*c*d - b*e)/((p + 1)*(b^2 -
 4*a*c))), Int[(a + b*x + c*x^2)^(p + 1), x], x] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d - b*e, 0] && NeQ[b^
2 - 4*a*c, 0] && LtQ[p, -1] && NeQ[p, -3/2]

Rule 2099

Int[(P_)^(p_)*(Q_)^(q_.), x_Symbol] :> With[{PP = Factor[P]}, Int[ExpandIntegrand[PP^p*Q^q, x], x] /;  !SumQ[N
onfreeFactors[PP, x]]] /; FreeQ[q, x] && PolyQ[P, x] && PolyQ[Q, x] && IntegerQ[p] && NeQ[P, x]

Rubi steps \begin{align*} \text {integral}& = \int \left (-\frac {4}{x^3}+\frac {2}{x^2}-\frac {1}{x}+\frac {-7+4 x}{\left (-1-x+x^2\right )^2}-\frac {2}{-1-x+x^2}\right ) \, dx \\ & = \frac {2}{x^2}-\frac {2}{x}-\log (x)-2 \int \frac {1}{-1-x+x^2} \, dx+\int \frac {-7+4 x}{\left (-1-x+x^2\right )^2} \, dx \\ & = \frac {2}{x^2}-\frac {2}{x}+\frac {3-2 x}{1+x-x^2}-\log (x)+2 \int \frac {1}{-1-x+x^2} \, dx+4 \text {Subst}\left (\int \frac {1}{5-x^2} \, dx,x,-1+2 x\right ) \\ & = \frac {2}{x^2}-\frac {2}{x}+\frac {3-2 x}{1+x-x^2}-\frac {4 \text {arctanh}\left (\frac {1-2 x}{\sqrt {5}}\right )}{\sqrt {5}}-\log (x)-4 \text {Subst}\left (\int \frac {1}{5-x^2} \, dx,x,-1+2 x\right ) \\ & = \frac {2}{x^2}-\frac {2}{x}+\frac {3-2 x}{1+x-x^2}-\log (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.87 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=-\frac {2-x^2}{x^2 \left (-1-x+x^2\right )}-\log (x) \]

[In]

Integrate[(-4 - 6*x + 7*x^2 - x^3 - x^4 + 2*x^5 - x^6)/(x^3 + 2*x^4 - x^5 - 2*x^6 + x^7),x]

[Out]

-((2 - x^2)/(x^2*(-1 - x + x^2))) - Log[x]

Maple [A] (verified)

Time = 0.09 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.81

method result size
norman \(\frac {x^{2}-2}{x^{2} \left (x^{2}-x -1\right )}-\ln \left (x \right )\) \(25\)
risch \(\frac {x^{2}-2}{x^{2} \left (x^{2}-x -1\right )}-\ln \left (x \right )\) \(25\)
default \(\frac {2}{x^{2}}-\frac {2}{x}-\ln \left (x \right )-\frac {3-2 x}{x^{2}-x -1}\) \(33\)
parallelrisch \(-\frac {x^{4} \ln \left (x \right )+2-x^{3} \ln \left (x \right )-x^{2} \ln \left (x \right )-x^{2}}{x^{2} \left (x^{2}-x -1\right )}\) \(43\)

[In]

int((-x^6+2*x^5-x^4-x^3+7*x^2-6*x-4)/(x^7-2*x^6-x^5+2*x^4+x^3),x,method=_RETURNVERBOSE)

[Out]

(x^2-2)/x^2/(x^2-x-1)-ln(x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.29 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=\frac {x^{2} - {\left (x^{4} - x^{3} - x^{2}\right )} \log \left (x\right ) - 2}{x^{4} - x^{3} - x^{2}} \]

[In]

integrate((-x^6+2*x^5-x^4-x^3+7*x^2-6*x-4)/(x^7-2*x^6-x^5+2*x^4+x^3),x, algorithm="fricas")

[Out]

(x^2 - (x^4 - x^3 - x^2)*log(x) - 2)/(x^4 - x^3 - x^2)

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.61 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=- \frac {2 - x^{2}}{x^{4} - x^{3} - x^{2}} - \log {\left (x \right )} \]

[In]

integrate((-x**6+2*x**5-x**4-x**3+7*x**2-6*x-4)/(x**7-2*x**6-x**5+2*x**4+x**3),x)

[Out]

-(2 - x**2)/(x**4 - x**3 - x**2) - log(x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.87 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=\frac {x^{2} - 2}{x^{4} - x^{3} - x^{2}} - \log \left (x\right ) \]

[In]

integrate((-x^6+2*x^5-x^4-x^3+7*x^2-6*x-4)/(x^7-2*x^6-x^5+2*x^4+x^3),x, algorithm="maxima")

[Out]

(x^2 - 2)/(x^4 - x^3 - x^2) - log(x)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.81 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=\frac {x^{2} - 2}{{\left (x^{2} - x - 1\right )} x^{2}} - \log \left ({\left | x \right |}\right ) \]

[In]

integrate((-x^6+2*x^5-x^4-x^3+7*x^2-6*x-4)/(x^7-2*x^6-x^5+2*x^4+x^3),x, algorithm="giac")

[Out]

(x^2 - 2)/((x^2 - x - 1)*x^2) - log(abs(x))

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.81 \[ \int \frac {-4-6 x+7 x^2-x^3-x^4+2 x^5-x^6}{x^3+2 x^4-x^5-2 x^6+x^7} \, dx=-\ln \left (x\right )-\frac {x^2-2}{x^2\,\left (-x^2+x+1\right )} \]

[In]

int(-(6*x - 7*x^2 + x^3 + x^4 - 2*x^5 + x^6 + 4)/(x^3 + 2*x^4 - x^5 - 2*x^6 + x^7),x)

[Out]

- log(x) - (x^2 - 2)/(x^2*(x - x^2 + 1))