\(\int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} (2 x^3-4 x^4+2 x^5)}{x^2-2 x^3+x^4} \, dx\) [6659]

   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 = 57, antiderivative size = 30 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=e^{x^2}+5 \left (-3+\frac {4}{x}\right )-\frac {(9-x) x}{1-x} \]

[Out]

20/x-15-x*(9-x)/(1-x)+exp(x^2)

Rubi [A] (verified)

Time = 0.26 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.77, number of steps used = 13, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {1608, 27, 6874, 46, 2240, 45} \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=e^{x^2}-x-\frac {8}{1-x}+\frac {20}{x} \]

[In]

Int[(-20 + 40*x - 29*x^2 + 2*x^3 - x^4 + E^x^2*(2*x^3 - 4*x^4 + 2*x^5))/(x^2 - 2*x^3 + x^4),x]

[Out]

E^x^2 - 8/(1 - x) + 20/x - x

Rule 27

Int[(u_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[u*Cancel[(b/2 + c*x)^(2*p)/c^p], x] /; Fr
eeQ[{a, b, c}, x] && EqQ[b^2 - 4*a*c, 0] && IntegerQ[p]

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 1608

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.) + (c_.)*(x_)^(r_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^
(q - p) + c*x^(r - p))^n, x] /; FreeQ[{a, b, c, p, q, r}, x] && IntegerQ[n] && PosQ[q - p] && PosQ[r - p]

Rule 2240

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] :> Simp[(e + f*x)^n*(
F^(a + b*(c + d*x)^n)/(b*f*n*(c + d*x)^n*Log[F])), x] /; FreeQ[{F, a, b, c, d, e, f, n}, x] && EqQ[m, n - 1] &
& EqQ[d*e - c*f, 0]

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps \begin{align*} \text {integral}& = \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2 \left (1-2 x+x^2\right )} \, dx \\ & = \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{(-1+x)^2 x^2} \, dx \\ & = \int \left (-\frac {29}{(-1+x)^2}-\frac {20}{(-1+x)^2 x^2}+\frac {40}{(-1+x)^2 x}+2 e^{x^2} x+\frac {2 x}{(-1+x)^2}-\frac {x^2}{(-1+x)^2}\right ) \, dx \\ & = -\frac {29}{1-x}+2 \int e^{x^2} x \, dx+2 \int \frac {x}{(-1+x)^2} \, dx-20 \int \frac {1}{(-1+x)^2 x^2} \, dx+40 \int \frac {1}{(-1+x)^2 x} \, dx-\int \frac {x^2}{(-1+x)^2} \, dx \\ & = e^{x^2}-\frac {29}{1-x}+2 \int \left (\frac {1}{(-1+x)^2}+\frac {1}{-1+x}\right ) \, dx-20 \int \left (\frac {1}{(-1+x)^2}-\frac {2}{-1+x}+\frac {1}{x^2}+\frac {2}{x}\right ) \, dx+40 \int \left (\frac {1}{1-x}+\frac {1}{(-1+x)^2}+\frac {1}{x}\right ) \, dx-\int \left (1+\frac {1}{(-1+x)^2}+\frac {2}{-1+x}\right ) \, dx \\ & = e^{x^2}-\frac {8}{1-x}+\frac {20}{x}-x \\ \end{align*}

Mathematica [A] (verified)

Time = 0.36 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.70 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=e^{x^2}+\frac {8}{-1+x}+\frac {20}{x}-x \]

[In]

Integrate[(-20 + 40*x - 29*x^2 + 2*x^3 - x^4 + E^x^2*(2*x^3 - 4*x^4 + 2*x^5))/(x^2 - 2*x^3 + x^4),x]

[Out]

E^x^2 + 8/(-1 + x) + 20/x - x

Maple [A] (verified)

Time = 0.21 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.70

method result size
parts \({\mathrm e}^{x^{2}}+\frac {20}{x}+\frac {8}{-1+x}-x\) \(21\)
risch \(-x +\frac {28 x -20}{x \left (-1+x \right )}+{\mathrm e}^{x^{2}}\) \(23\)
parallelrisch \(-\frac {x^{3}-x^{2} {\mathrm e}^{x^{2}}+20+{\mathrm e}^{x^{2}} x -29 x}{x \left (-1+x \right )}\) \(34\)
norman \(\frac {-20+x^{2} {\mathrm e}^{x^{2}}+29 x -x^{3}-{\mathrm e}^{x^{2}} x}{x \left (-1+x \right )}\) \(35\)

[In]

int(((2*x^5-4*x^4+2*x^3)*exp(x^2)-x^4+2*x^3-29*x^2+40*x-20)/(x^4-2*x^3+x^2),x,method=_RETURNVERBOSE)

[Out]

exp(x^2)+20/x+8/(-1+x)-x

Fricas [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.23 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=-\frac {x^{3} - x^{2} - {\left (x^{2} - x\right )} e^{\left (x^{2}\right )} - 28 \, x + 20}{x^{2} - x} \]

[In]

integrate(((2*x^5-4*x^4+2*x^3)*exp(x^2)-x^4+2*x^3-29*x^2+40*x-20)/(x^4-2*x^3+x^2),x, algorithm="fricas")

[Out]

-(x^3 - x^2 - (x^2 - x)*e^(x^2) - 28*x + 20)/(x^2 - x)

Sympy [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.50 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=- x - \frac {20 - 28 x}{x^{2} - x} + e^{x^{2}} \]

[In]

integrate(((2*x**5-4*x**4+2*x**3)*exp(x**2)-x**4+2*x**3-29*x**2+40*x-20)/(x**4-2*x**3+x**2),x)

[Out]

-x - (20 - 28*x)/(x**2 - x) + exp(x**2)

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.03 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=-x + \frac {20 \, {\left (2 \, x - 1\right )}}{x^{2} - x} - \frac {12}{x - 1} + e^{\left (x^{2}\right )} \]

[In]

integrate(((2*x^5-4*x^4+2*x^3)*exp(x^2)-x^4+2*x^3-29*x^2+40*x-20)/(x^4-2*x^3+x^2),x, algorithm="maxima")

[Out]

-x + 20*(2*x - 1)/(x^2 - x) - 12/(x - 1) + e^(x^2)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.30 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx=-\frac {x^{3} - x^{2} e^{\left (x^{2}\right )} - x^{2} + x e^{\left (x^{2}\right )} - 28 \, x + 20}{x^{2} - x} \]

[In]

integrate(((2*x^5-4*x^4+2*x^3)*exp(x^2)-x^4+2*x^3-29*x^2+40*x-20)/(x^4-2*x^3+x^2),x, algorithm="giac")

[Out]

-(x^3 - x^2*e^(x^2) - x^2 + x*e^(x^2) - 28*x + 20)/(x^2 - x)

Mupad [B] (verification not implemented)

Time = 12.46 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.73 \[ \int \frac {-20+40 x-29 x^2+2 x^3-x^4+e^{x^2} \left (2 x^3-4 x^4+2 x^5\right )}{x^2-2 x^3+x^4} \, dx={\mathrm {e}}^{x^2}-x+\frac {28\,x-20}{x\,\left (x-1\right )} \]

[In]

int((40*x + exp(x^2)*(2*x^3 - 4*x^4 + 2*x^5) - 29*x^2 + 2*x^3 - x^4 - 20)/(x^2 - 2*x^3 + x^4),x)

[Out]

exp(x^2) - x + (28*x - 20)/(x*(x - 1))