3.98 \(\int \frac {2-x+x^2}{4-5 x^2+x^4} \, dx\)

Optimal. Leaf size=37 \[ -\frac {1}{3} \log (1-x)+\frac {1}{3} \log (2-x)+\frac {2}{3} \log (x+1)-\frac {2}{3} \log (x+2) \]

________________________________________________________________________________________

Rubi [A]  time = 0.04, antiderivative size = 61, normalized size of antiderivative = 1.65, number of steps used = 12, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {1673, 1161, 616, 31, 1107} \[ \frac {1}{6} \log \left (1-x^2\right )-\frac {1}{6} \log \left (4-x^2\right )-\frac {1}{2} \log (1-x)+\frac {1}{2} \log (2-x)+\frac {1}{2} \log (x+1)-\frac {1}{2} \log (x+2) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-Log[1 - x]/2 + Log[2 - x]/2 + Log[1 + x]/2 - Log[2 + x]/2 + Log[1 - x^2]/6 - Log[4 - x^2]/6

Rule 31

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

Rule 616

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

Rule 1107

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

Rule 1161

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[(2*d)/e - b/c, 2]},
Dist[e/(2*c), Int[1/Simp[d/e + q*x + x^2, x], x], x] + Dist[e/(2*c), Int[1/Simp[d/e - q*x + x^2, x], x], x]] /
; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && EqQ[c*d^2 - a*e^2, 0] && (GtQ[(2*d)/e - b/c, 0] || ( !Lt
Q[(2*d)/e - b/c, 0] && EqQ[d - e*Rt[a/c, 2], 0]))

Rule 1673

Int[(Pq_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Module[{q = Expon[Pq, x], k}, Int[Sum[Coeff[
Pq, x, 2*k]*x^(2*k), {k, 0, q/2}]*(a + b*x^2 + c*x^4)^p, x] + Int[x*Sum[Coeff[Pq, x, 2*k + 1]*x^(2*k), {k, 0,
(q - 1)/2}]*(a + b*x^2 + c*x^4)^p, x]] /; FreeQ[{a, b, c, p}, x] && PolyQ[Pq, x] &&  !PolyQ[Pq, x^2]

Rubi steps

\begin {align*} \int \frac {2-x+x^2}{4-5 x^2+x^4} \, dx &=-\int \frac {x}{4-5 x^2+x^4} \, dx+\int \frac {2+x^2}{4-5 x^2+x^4} \, dx\\ &=\frac {1}{2} \int \frac {1}{2-3 x+x^2} \, dx+\frac {1}{2} \int \frac {1}{2+3 x+x^2} \, dx-\frac {1}{2} \operatorname {Subst}\left (\int \frac {1}{4-5 x+x^2} \, dx,x,x^2\right )\\ &=-\left (\frac {1}{6} \operatorname {Subst}\left (\int \frac {1}{-4+x} \, dx,x,x^2\right )\right )+\frac {1}{6} \operatorname {Subst}\left (\int \frac {1}{-1+x} \, dx,x,x^2\right )+\frac {1}{2} \int \frac {1}{-2+x} \, dx-\frac {1}{2} \int \frac {1}{-1+x} \, dx+\frac {1}{2} \int \frac {1}{1+x} \, dx-\frac {1}{2} \int \frac {1}{2+x} \, dx\\ &=-\frac {1}{2} \log (1-x)+\frac {1}{2} \log (2-x)+\frac {1}{2} \log (1+x)-\frac {1}{2} \log (2+x)+\frac {1}{6} \log \left (1-x^2\right )-\frac {1}{6} \log \left (4-x^2\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.01, size = 37, normalized size = 1.00 \[ -\frac {1}{3} \log (1-x)+\frac {1}{3} \log (2-x)+\frac {2}{3} \log (x+1)-\frac {2}{3} \log (x+2) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

IntegrateAlgebraic [A]  time = 0.01, size = 21, normalized size = 0.57 \[ \frac {2}{3} \tanh ^{-1}(3-2 x)-\frac {4}{3} \tanh ^{-1}(2 x+3) \]

Antiderivative was successfully verified.

[In]

IntegrateAlgebraic[(2 - x + x^2)/(4 - 5*x^2 + x^4),x]

[Out]

(2*ArcTanh[3 - 2*x])/3 - (4*ArcTanh[3 + 2*x])/3

________________________________________________________________________________________

fricas [A]  time = 0.72, size = 25, normalized size = 0.68 \[ -\frac {2}{3} \, \log \left (x + 2\right ) + \frac {2}{3} \, \log \left (x + 1\right ) - \frac {1}{3} \, \log \left (x - 1\right ) + \frac {1}{3} \, \log \left (x - 2\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.99, size = 29, normalized size = 0.78 \[ -\frac {2}{3} \, \log \left ({\left | x + 2 \right |}\right ) + \frac {2}{3} \, \log \left ({\left | x + 1 \right |}\right ) - \frac {1}{3} \, \log \left ({\left | x - 1 \right |}\right ) + \frac {1}{3} \, \log \left ({\left | x - 2 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-2/3*log(abs(x + 2)) + 2/3*log(abs(x + 1)) - 1/3*log(abs(x - 1)) + 1/3*log(abs(x - 2))

________________________________________________________________________________________

maple [A]  time = 0.04, size = 26, normalized size = 0.70




method result size



default \(\frac {\ln \left (-2+x \right )}{3}-\frac {2 \ln \left (2+x \right )}{3}-\frac {\ln \left (-1+x \right )}{3}+\frac {2 \ln \left (1+x \right )}{3}\) \(26\)
norman \(\frac {\ln \left (-2+x \right )}{3}-\frac {2 \ln \left (2+x \right )}{3}-\frac {\ln \left (-1+x \right )}{3}+\frac {2 \ln \left (1+x \right )}{3}\) \(26\)
risch \(\frac {\ln \left (-2+x \right )}{3}-\frac {2 \ln \left (2+x \right )}{3}-\frac {\ln \left (-1+x \right )}{3}+\frac {2 \ln \left (1+x \right )}{3}\) \(26\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/3*ln(-2+x)-2/3*ln(2+x)-1/3*ln(-1+x)+2/3*ln(1+x)

________________________________________________________________________________________

maxima [A]  time = 0.45, size = 25, normalized size = 0.68 \[ -\frac {2}{3} \, \log \left (x + 2\right ) + \frac {2}{3} \, \log \left (x + 1\right ) - \frac {1}{3} \, \log \left (x - 1\right ) + \frac {1}{3} \, \log \left (x - 2\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.06, size = 29, normalized size = 0.78 \[ \frac {2\,\mathrm {atanh}\left (\frac {64}{3\,\left (24\,x-16\right )}-\frac {5}{3}\right )}{3}+\frac {4\,\mathrm {atanh}\left (\frac {128}{3\,\left (48\,x+32\right )}+\frac {5}{3}\right )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(2*atanh(64/(3*(24*x - 16)) - 5/3))/3 + (4*atanh(128/(3*(48*x + 32)) + 5/3))/3

________________________________________________________________________________________

sympy [A]  time = 0.19, size = 29, normalized size = 0.78 \[ \frac {\log {\left (x - 2 \right )}}{3} - \frac {\log {\left (x - 1 \right )}}{3} + \frac {2 \log {\left (x + 1 \right )}}{3} - \frac {2 \log {\left (x + 2 \right )}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________