Optimal. Leaf size=26 \[ 4-\frac {3 e^{-x}}{x}-2 x+\frac {2}{3+x}-5 \log (5) \]
________________________________________________________________________________________
Rubi [A] time = 0.98, antiderivative size = 21, normalized size of antiderivative = 0.81, number of steps used = 27, number of rules used = 7, integrand size = 57, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.123, Rules used = {1594, 27, 6742, 2177, 2178, 2199, 683} \begin {gather*} -2 x+\frac {2}{x+3}-\frac {3 e^{-x}}{x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 27
Rule 683
Rule 1594
Rule 2177
Rule 2178
Rule 2199
Rule 6742
Rubi steps
\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {e^{-x} \left (27+45 x+21 x^2+3 x^3+e^x \left (-20 x^2-12 x^3-2 x^4\right )\right )}{x^2 \left (9+6 x+x^2\right )} \, dx\\ &=\int \frac {e^{-x} \left (27+45 x+21 x^2+3 x^3+e^x \left (-20 x^2-12 x^3-2 x^4\right )\right )}{x^2 (3+x)^2} \, dx\\ &=\int \left (\frac {21 e^{-x}}{(3+x)^2}+\frac {27 e^{-x}}{x^2 (3+x)^2}+\frac {45 e^{-x}}{x (3+x)^2}+\frac {3 e^{-x} x}{(3+x)^2}-\frac {2 \left (10+6 x+x^2\right )}{(3+x)^2}\right ) \, dx\\ &=-\left (2 \int \frac {10+6 x+x^2}{(3+x)^2} \, dx\right )+3 \int \frac {e^{-x} x}{(3+x)^2} \, dx+21 \int \frac {e^{-x}}{(3+x)^2} \, dx+27 \int \frac {e^{-x}}{x^2 (3+x)^2} \, dx+45 \int \frac {e^{-x}}{x (3+x)^2} \, dx\\ &=-\frac {21 e^{-x}}{3+x}-2 \int \left (1+\frac {1}{(3+x)^2}\right ) \, dx+3 \int \left (-\frac {3 e^{-x}}{(3+x)^2}+\frac {e^{-x}}{3+x}\right ) \, dx-21 \int \frac {e^{-x}}{3+x} \, dx+27 \int \left (\frac {e^{-x}}{9 x^2}-\frac {2 e^{-x}}{27 x}+\frac {e^{-x}}{9 (3+x)^2}+\frac {2 e^{-x}}{27 (3+x)}\right ) \, dx+45 \int \left (\frac {e^{-x}}{9 x}-\frac {e^{-x}}{3 (3+x)^2}-\frac {e^{-x}}{9 (3+x)}\right ) \, dx\\ &=-2 x+\frac {2}{3+x}-\frac {21 e^{-x}}{3+x}-21 e^3 \text {Ei}(-3-x)-2 \int \frac {e^{-x}}{x} \, dx+2 \int \frac {e^{-x}}{3+x} \, dx+3 \int \frac {e^{-x}}{x^2} \, dx+3 \int \frac {e^{-x}}{(3+x)^2} \, dx+3 \int \frac {e^{-x}}{3+x} \, dx+5 \int \frac {e^{-x}}{x} \, dx-5 \int \frac {e^{-x}}{3+x} \, dx-9 \int \frac {e^{-x}}{(3+x)^2} \, dx-15 \int \frac {e^{-x}}{(3+x)^2} \, dx\\ &=-\frac {3 e^{-x}}{x}-2 x+\frac {2}{3+x}-21 e^3 \text {Ei}(-3-x)+3 \text {Ei}(-x)-3 \int \frac {e^{-x}}{x} \, dx-3 \int \frac {e^{-x}}{3+x} \, dx+9 \int \frac {e^{-x}}{3+x} \, dx+15 \int \frac {e^{-x}}{3+x} \, dx\\ &=-\frac {3 e^{-x}}{x}-2 x+\frac {2}{3+x}\\ \end {aligned} \end {gather*}
________________________________________________________________________________________
Mathematica [A] time = 0.37, size = 21, normalized size = 0.81 \begin {gather*} -\frac {3 e^{-x}}{x}-2 x+\frac {2}{3+x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.57, size = 36, normalized size = 1.38 \begin {gather*} -\frac {{\left (2 \, {\left (x^{3} + 3 \, x^{2} - x\right )} e^{x} + 3 \, x + 9\right )} e^{\left (-x\right )}}{x^{2} + 3 \, x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.20, size = 38, normalized size = 1.46 \begin {gather*} -\frac {2 \, x^{3} + 6 \, x^{2} + 3 \, x e^{\left (-x\right )} - 2 \, x + 9 \, e^{\left (-x\right )}}{x^{2} + 3 \, x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.06, size = 21, normalized size = 0.81
method | result | size |
risch | \(\frac {2}{3+x}-2 x -\frac {3 \,{\mathrm e}^{-x}}{x}\) | \(21\) |
norman | \(\frac {\left (-9+20 \,{\mathrm e}^{x} x -3 x -2 \,{\mathrm e}^{x} x^{3}\right ) {\mathrm e}^{-x}}{\left (3+x \right ) x}\) | \(31\) |
default | \(\frac {2}{3+x}-2 x -\frac {3 \,{\mathrm e}^{-x} \left (2 x +3\right )}{\left (3+x \right ) x}+\frac {3 \,{\mathrm e}^{-x}}{3+x}\) | \(42\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.41, size = 34, normalized size = 1.31 \begin {gather*} -\frac {2 \, x^{3} + 6 \, x^{2} + 3 \, {\left (x + 3\right )} e^{\left (-x\right )} - 2 \, x}{x^{2} + 3 \, x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 5.34, size = 31, normalized size = 1.19 \begin {gather*} -2\,x-\frac {9\,{\mathrm {e}}^{-x}+x\,\left (3\,{\mathrm {e}}^{-x}-2\right )}{x\,\left (x+3\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.17, size = 14, normalized size = 0.54 \begin {gather*} - 2 x + \frac {2}{x + 3} - \frac {3 e^{- x}}{x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________