\(\int \frac {e^{2 x} (-4 x+4 x^2)+e^x (-4 x^2+4 x^3)+e^{2 x} (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3)}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx\) [10260]

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

Optimal result

Integrand size = 89, antiderivative size = 25 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {2 \left (1+\frac {e^x}{x}\right )^2 x}{-e^{2 x}+x} \]

[Out]

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

Rubi [F]

\[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx \]

[In]

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

[Out]

-(E^(2*x) - x)^(-1) + 1/((E^(2*x) - x)*x) - (2*x)/(E^(2*x) - x) + Defer[Int][(E^(2*x) - x)^(-2), x] - 4*Defer[
Int][E^x/(E^(2*x) - x)^2, x] + 2*Defer[Int][(E^(2*x) - x)^(-1), x] + 4*Defer[Int][E^x/(E^(2*x) - x), x] + Defe
r[Int][1/((E^(2*x) - x)*x^2), x] + 2*Defer[Int][E^(2*x)/((E^(2*x) - x)*x^2), x] - Defer[Int][1/((E^(2*x) - x)^
2*x), x] + 2*Defer[Int][x/(E^(2*x) - x)^2, x] + 8*Defer[Int][(E^x*x)/(E^(2*x) - x)^2, x]

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

Mathematica [A] (verified)

Time = 4.74 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.92 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {2 \left (e^x+x\right )^2}{x \left (-e^{2 x}+x\right )} \]

[In]

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

[Out]

(2*(E^x + x)^2)/(x*(-E^(2*x) + x))

Maple [A] (verified)

Time = 0.15 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.04

method result size
risch \(-\frac {2}{x}+\frac {2 x +4 \,{\mathrm e}^{x}+2}{x -{\mathrm e}^{2 x}}\) \(26\)
parallelrisch \(-\frac {-2 x^{2}-4 \,{\mathrm e}^{x} x -2 \,{\mathrm e}^{2 x}}{x \left (x -{\mathrm e}^{2 x}\right )}\) \(33\)
norman \(\frac {2 x \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{2 x}+4 \,{\mathrm e}^{x} x}{x \left (x -{\mathrm e}^{2 x}\right )}\) \(34\)
parts \(\frac {2 \,{\mathrm e}^{2 x}}{x \left (x -{\mathrm e}^{2 x}\right )}+\frac {4 \,{\mathrm e}^{x}}{x -{\mathrm e}^{2 x}}+\frac {2 \,{\mathrm e}^{2 x}}{x -{\mathrm e}^{2 x}}\) \(51\)

[In]

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

[Out]

-2/x+2*(x+2*exp(x)+1)/(x-exp(2*x))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.12 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {2 \, {\left (x^{2} + 2 \, x e^{x} + e^{\left (2 \, x\right )}\right )}}{x^{2} - x e^{\left (2 \, x\right )}} \]

[In]

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

[Out]

2*(x^2 + 2*x*e^x + e^(2*x))/(x^2 - x*e^(2*x))

Sympy [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.80 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {- 2 x - 4 e^{x} - 2}{- x + e^{2 x}} - \frac {2}{x} \]

[In]

integrate(((2*exp(x)**2+4*exp(x)*x**2+4*x**3-2*x**2)*exp(2*x)+(4*x**2-4*x)*exp(x)**2+(4*x**3-4*x**2)*exp(x))/(
x**2*exp(2*x)**2-2*exp(2*x)*x**3+x**4),x)

[Out]

(-2*x - 4*exp(x) - 2)/(-x + exp(2*x)) - 2/x

Maxima [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.12 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {2 \, {\left (x^{2} + 2 \, x e^{x} + e^{\left (2 \, x\right )}\right )}}{x^{2} - x e^{\left (2 \, x\right )}} \]

[In]

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

[Out]

2*(x^2 + 2*x*e^x + e^(2*x))/(x^2 - x*e^(2*x))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 62 vs. \(2 (23) = 46\).

Time = 0.28 (sec) , antiderivative size = 62, normalized size of antiderivative = 2.48 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {2 \, {\left (x^{3} - x^{2} e^{\left (2 \, x\right )} + 4 \, x^{2} e^{x} - 4 \, x e^{\left (3 \, x\right )} + x e^{\left (2 \, x\right )} - e^{\left (4 \, x\right )}\right )}}{x^{3} - 2 \, x^{2} e^{\left (2 \, x\right )} + x e^{\left (4 \, x\right )}} \]

[In]

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

[Out]

2*(x^3 - x^2*e^(2*x) + 4*x^2*e^x - 4*x*e^(3*x) + x*e^(2*x) - e^(4*x))/(x^3 - 2*x^2*e^(2*x) + x*e^(4*x))

Mupad [B] (verification not implemented)

Time = 14.70 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.84 \[ \int \frac {e^{2 x} \left (-4 x+4 x^2\right )+e^x \left (-4 x^2+4 x^3\right )+e^{2 x} \left (2 e^{2 x}-2 x^2+4 e^x x^2+4 x^3\right )}{e^{4 x} x^2-2 e^{2 x} x^3+x^4} \, dx=\frac {2\,{\left (x+{\mathrm {e}}^x\right )}^2}{x\,\left (x-{\mathrm {e}}^{2\,x}\right )} \]

[In]

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

[Out]

(2*(x + exp(x))^2)/(x*(x - exp(2*x)))