Optimal. Leaf size=28 \[ -3+x-\frac {e^{-x} \left (x+(30+x) \left (8+\frac {x}{-4+x}\right )\right )}{x} \]
________________________________________________________________________________________
Rubi [A] time = 1.52, antiderivative size = 33, normalized size of antiderivative = 1.18, number of steps used = 31, number of rules used = 7, integrand size = 60, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.117, Rules used = {1594, 27, 6742, 2177, 2178, 2199, 2194} \begin {gather*} x-10 e^{-x}+\frac {34 e^{-x}}{4-x}-\frac {240 e^{-x}}{x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 27
Rule 1594
Rule 2177
Rule 2178
Rule 2194
Rule 2199
Rule 6742
Rubi steps
\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {e^{-x} \left (3840+1920 x-1622 x^2+194 x^3+10 x^4+e^x \left (16 x^2-8 x^3+x^4\right )\right )}{x^2 \left (16-8 x+x^2\right )} \, dx\\ &=\int \frac {e^{-x} \left (3840+1920 x-1622 x^2+194 x^3+10 x^4+e^x \left (16 x^2-8 x^3+x^4\right )\right )}{(-4+x)^2 x^2} \, dx\\ &=\int \left (1-\frac {1622 e^{-x}}{(-4+x)^2}+\frac {3840 e^{-x}}{(-4+x)^2 x^2}+\frac {1920 e^{-x}}{(-4+x)^2 x}+\frac {194 e^{-x} x}{(-4+x)^2}+\frac {10 e^{-x} x^2}{(-4+x)^2}\right ) \, dx\\ &=x+10 \int \frac {e^{-x} x^2}{(-4+x)^2} \, dx+194 \int \frac {e^{-x} x}{(-4+x)^2} \, dx-1622 \int \frac {e^{-x}}{(-4+x)^2} \, dx+1920 \int \frac {e^{-x}}{(-4+x)^2 x} \, dx+3840 \int \frac {e^{-x}}{(-4+x)^2 x^2} \, dx\\ &=-\frac {1622 e^{-x}}{4-x}+x+10 \int \left (e^{-x}+\frac {16 e^{-x}}{(-4+x)^2}+\frac {8 e^{-x}}{-4+x}\right ) \, dx+194 \int \left (\frac {4 e^{-x}}{(-4+x)^2}+\frac {e^{-x}}{-4+x}\right ) \, dx+1622 \int \frac {e^{-x}}{-4+x} \, dx+1920 \int \left (\frac {e^{-x}}{4 (-4+x)^2}-\frac {e^{-x}}{16 (-4+x)}+\frac {e^{-x}}{16 x}\right ) \, dx+3840 \int \left (\frac {e^{-x}}{16 (-4+x)^2}-\frac {e^{-x}}{32 (-4+x)}+\frac {e^{-x}}{16 x^2}+\frac {e^{-x}}{32 x}\right ) \, dx\\ &=-\frac {1622 e^{-x}}{4-x}+x+\frac {1622 \text {Ei}(4-x)}{e^4}+10 \int e^{-x} \, dx+80 \int \frac {e^{-x}}{-4+x} \, dx-2 \left (120 \int \frac {e^{-x}}{-4+x} \, dx\right )+2 \left (120 \int \frac {e^{-x}}{x} \, dx\right )+160 \int \frac {e^{-x}}{(-4+x)^2} \, dx+194 \int \frac {e^{-x}}{-4+x} \, dx+240 \int \frac {e^{-x}}{(-4+x)^2} \, dx+240 \int \frac {e^{-x}}{x^2} \, dx+480 \int \frac {e^{-x}}{(-4+x)^2} \, dx+776 \int \frac {e^{-x}}{(-4+x)^2} \, dx\\ &=-10 e^{-x}+\frac {34 e^{-x}}{4-x}-\frac {240 e^{-x}}{x}+x+\frac {1656 \text {Ei}(4-x)}{e^4}+240 \text {Ei}(-x)-160 \int \frac {e^{-x}}{-4+x} \, dx-240 \int \frac {e^{-x}}{-4+x} \, dx-240 \int \frac {e^{-x}}{x} \, dx-480 \int \frac {e^{-x}}{-4+x} \, dx-776 \int \frac {e^{-x}}{-4+x} \, dx\\ &=-10 e^{-x}+\frac {34 e^{-x}}{4-x}-\frac {240 e^{-x}}{x}+x\\ \end {aligned} \end {gather*}
________________________________________________________________________________________
Mathematica [A] time = 0.41, size = 22, normalized size = 0.79 \begin {gather*} e^{-x} \left (-10-\frac {34}{-4+x}-\frac {240}{x}\right )+x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 1.09, size = 38, normalized size = 1.36 \begin {gather*} -\frac {{\left (10 \, x^{2} - {\left (x^{3} - 4 \, x^{2}\right )} e^{x} + 234 \, x - 960\right )} e^{\left (-x\right )}}{x^{2} - 4 \, x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.36, size = 41, normalized size = 1.46 \begin {gather*} \frac {x^{3} - 10 \, x^{2} e^{\left (-x\right )} - 4 \, x^{2} - 234 \, x e^{\left (-x\right )} + 960 \, e^{\left (-x\right )}}{x^{2} - 4 \, x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.06, size = 27, normalized size = 0.96
method | result | size |
risch | \(x -\frac {2 \left (5 x^{2}+117 x -480\right ) {\mathrm e}^{-x}}{\left (x -4\right ) x}\) | \(27\) |
norman | \(\frac {\left (960+{\mathrm e}^{x} x^{3}-16 \,{\mathrm e}^{x} x -234 x -10 x^{2}\right ) {\mathrm e}^{-x}}{x \left (x -4\right )}\) | \(35\) |
default | \(x -\frac {480 \,{\mathrm e}^{-x} \left (x -2\right )}{\left (x -4\right ) x}+\frac {206 \,{\mathrm e}^{-x}}{x -4}-10 \,{\mathrm e}^{-x}\) | \(37\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.39, size = 35, normalized size = 1.25 \begin {gather*} \frac {x^{3} - 4 \, x^{2} - 2 \, {\left (5 \, x^{2} + 117 \, x - 480\right )} e^{\left (-x\right )}}{x^{2} - 4 \, x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.96, size = 32, normalized size = 1.14 \begin {gather*} {\mathrm {e}}^{-x}\,\left (x\,{\mathrm {e}}^x-10\right )-\frac {240\,{\mathrm {e}}^{-x}}{x}-\frac {34\,{\mathrm {e}}^{-x}}{x-4} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.13, size = 20, normalized size = 0.71 \begin {gather*} x + \frac {\left (- 10 x^{2} - 234 x + 960\right ) e^{- x}}{x^{2} - 4 x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________