Optimal. Leaf size=35 \[ e^x x^2+\frac {1-e^2 \left (1+e^{2/x}\right ) x}{x-x^2} \]
________________________________________________________________________________________
Rubi [A] time = 0.58, antiderivative size = 48, normalized size of antiderivative = 1.37, number of steps used = 16, number of rules used = 8, integrand size = 66, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.121, Rules used = {1594, 27, 6742, 44, 2196, 2176, 2194, 2288} \begin {gather*} e^x x^2-\frac {e^{\frac {2}{x}+2}}{1-x}-\frac {e^2}{1-x}+\frac {1}{1-x}+\frac {1}{x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 27
Rule 44
Rule 1594
Rule 2176
Rule 2194
Rule 2196
Rule 2288
Rule 6742
Rubi steps
\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {-1+2 x-e^2 x^2+e^{2+\frac {2}{x}} \left (2-2 x-x^2\right )+e^x \left (2 x^3-3 x^4+x^6\right )}{x^2 \left (1-2 x+x^2\right )} \, dx\\ &=\int \frac {-1+2 x-e^2 x^2+e^{2+\frac {2}{x}} \left (2-2 x-x^2\right )+e^x \left (2 x^3-3 x^4+x^6\right )}{(-1+x)^2 x^2} \, dx\\ &=\int \left (-\frac {e^2}{(-1+x)^2}-\frac {1}{(-1+x)^2 x^2}+\frac {2}{(-1+x)^2 x}+e^x x (2+x)-\frac {e^{2+\frac {2}{x}} \left (-2+2 x+x^2\right )}{(-1+x)^2 x^2}\right ) \, dx\\ &=-\frac {e^2}{1-x}+2 \int \frac {1}{(-1+x)^2 x} \, dx-\int \frac {1}{(-1+x)^2 x^2} \, dx+\int e^x x (2+x) \, dx-\int \frac {e^{2+\frac {2}{x}} \left (-2+2 x+x^2\right )}{(-1+x)^2 x^2} \, dx\\ &=-\frac {e^2}{1-x}-\frac {e^{2+\frac {2}{x}}}{1-x}+2 \int \left (\frac {1}{1-x}+\frac {1}{(-1+x)^2}+\frac {1}{x}\right ) \, dx-\int \left (\frac {1}{(-1+x)^2}-\frac {2}{-1+x}+\frac {1}{x^2}+\frac {2}{x}\right ) \, dx+\int \left (2 e^x x+e^x x^2\right ) \, dx\\ &=\frac {1}{1-x}-\frac {e^2}{1-x}-\frac {e^{2+\frac {2}{x}}}{1-x}+\frac {1}{x}+2 \int e^x x \, dx+\int e^x x^2 \, dx\\ &=\frac {1}{1-x}-\frac {e^2}{1-x}-\frac {e^{2+\frac {2}{x}}}{1-x}+\frac {1}{x}+2 e^x x+e^x x^2-2 \int e^x \, dx-2 \int e^x x \, dx\\ &=-2 e^x+\frac {1}{1-x}-\frac {e^2}{1-x}-\frac {e^{2+\frac {2}{x}}}{1-x}+\frac {1}{x}+e^x x^2+2 \int e^x \, dx\\ &=\frac {1}{1-x}-\frac {e^2}{1-x}-\frac {e^{2+\frac {2}{x}}}{1-x}+\frac {1}{x}+e^x x^2\\ \end {aligned} \end {gather*}
________________________________________________________________________________________
Mathematica [A] time = 0.12, size = 37, normalized size = 1.06 \begin {gather*} \frac {-1+e^2 x+e^{2+\frac {2}{x}} x+e^x (-1+x) x^3}{(-1+x) x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.74, size = 39, normalized size = 1.11 \begin {gather*} \frac {x e^{2} + {\left (x^{4} - x^{3}\right )} e^{x} + x e^{\left (\frac {2 \, {\left (x + 1\right )}}{x}\right )} - 1}{x^{2} - x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.17, size = 40, normalized size = 1.14 \begin {gather*} \frac {x^{4} e^{x} - x^{3} e^{x} + x e^{2} + x e^{\left (\frac {2 \, {\left (x + 1\right )}}{x}\right )} - 1}{x^{2} - x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.09, size = 38, normalized size = 1.09
method | result | size |
risch | \(\frac {{\mathrm e}^{2} x -1}{x \left (x -1\right )}+{\mathrm e}^{x} x^{2}+\frac {{\mathrm e}^{\frac {2 x +2}{x}}}{x -1}\) | \(38\) |
norman | \(\frac {-1+{\mathrm e}^{2} x +{\mathrm e}^{x} x^{4}+{\mathrm e}^{2} {\mathrm e}^{\frac {2}{x}} x -{\mathrm e}^{x} x^{3}}{x \left (x -1\right )}\) | \(39\) |
default | \({\mathrm e}^{x} x^{2}-\frac {1}{x -1}+\frac {1}{x}+\frac {{\mathrm e}^{2}}{x -1}+2 \,{\mathrm e}^{2} \left (-\frac {{\mathrm e}^{\frac {2}{x}}}{2}+4 \,{\mathrm e}^{2} \expIntegralEi \left (1, -\frac {2}{x}+2\right )+\frac {{\mathrm e}^{\frac {2}{x}}}{\frac {1}{x}-1}\right )-2 \,{\mathrm e}^{2} \left (3 \,{\mathrm e}^{2} \expIntegralEi \left (1, -\frac {2}{x}+2\right )+\frac {{\mathrm e}^{\frac {2}{x}}}{\frac {1}{x}-1}\right )-{\mathrm e}^{2} \left (\frac {{\mathrm e}^{\frac {2}{x}}}{\frac {1}{x}-1}+2 \,{\mathrm e}^{2} \expIntegralEi \left (1, -\frac {2}{x}+2\right )\right )\) | \(130\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.72, size = 58, normalized size = 1.66 \begin {gather*} \frac {2 \, x - 1}{x^{2} - x} + \frac {{\left (x^{3} - x^{2}\right )} e^{x} + e^{\left (\frac {2}{x} + 2\right )}}{x - 1} + \frac {e^{2}}{x - 1} - \frac {2}{x - 1} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.30, size = 38, normalized size = 1.09 \begin {gather*} x^2\,{\mathrm {e}}^x-\frac {x\,{\mathrm {e}}^2-1}{x-x^2}+\frac {{\mathrm {e}}^{\frac {2}{x}+2}}{x-1} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.52, size = 29, normalized size = 0.83 \begin {gather*} x^{2} e^{x} - \frac {- x e^{2} + 1}{x^{2} - x} + \frac {e^{2} e^{\frac {2}{x}}}{x - 1} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________