Optimal. Leaf size=23 \[ \frac {-3+e^{2+2 x}}{x \left (1-x+x^2\right )} \]
________________________________________________________________________________________
Rubi [C] time = 1.90, antiderivative size = 467, normalized size of antiderivative = 20.30, number of steps used = 31, number of rules used = 6, integrand size = 58, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.103, Rules used = {6688, 6742, 2177, 2178, 6728, 1590} \begin {gather*} -\frac {1}{3} \left (3+2 i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (2 x-i \sqrt {3}-1\right )+\frac {1}{3} \left (1+i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (2 x-i \sqrt {3}-1\right )+\frac {i e^{3+i \sqrt {3}} \text {Ei}\left (2 x-i \sqrt {3}-1\right )}{\sqrt {3}}+\frac {2}{3} e^{3+i \sqrt {3}} \text {Ei}\left (2 x-i \sqrt {3}-1\right )-\frac {1}{3} \left (3-2 i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (2 x+i \sqrt {3}-1\right )+\frac {1}{3} \left (1-i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (2 x+i \sqrt {3}-1\right )-\frac {i e^{3-i \sqrt {3}} \text {Ei}\left (2 x+i \sqrt {3}-1\right )}{\sqrt {3}}+\frac {2}{3} e^{3-i \sqrt {3}} \text {Ei}\left (2 x+i \sqrt {3}-1\right )-\frac {3}{x \left (x^2-x+1\right )}+\frac {\left (1-i \sqrt {3}\right ) e^{2 x+2}}{3 \left (-2 x-i \sqrt {3}+1\right )}+\frac {2 e^{2 x+2}}{3 \left (-2 x-i \sqrt {3}+1\right )}+\frac {\left (1+i \sqrt {3}\right ) e^{2 x+2}}{3 \left (-2 x+i \sqrt {3}+1\right )}+\frac {2 e^{2 x+2}}{3 \left (-2 x+i \sqrt {3}+1\right )}+\frac {e^{2 x+2}}{x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 1590
Rule 2177
Rule 2178
Rule 6688
Rule 6728
Rule 6742
Rubi steps
\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {3-6 x+9 x^2+e^{2+2 x} (-1+x)^2 (-1+2 x)}{x^2 \left (1-x+x^2\right )^2} \, dx\\ &=\int \left (\frac {e^{2+2 x} (-1+x)^2 (-1+2 x)}{x^2 \left (1-x+x^2\right )^2}+\frac {3 \left (1-2 x+3 x^2\right )}{x^2 \left (1-x+x^2\right )^2}\right ) \, dx\\ &=3 \int \frac {1-2 x+3 x^2}{x^2 \left (1-x+x^2\right )^2} \, dx+\int \frac {e^{2+2 x} (-1+x)^2 (-1+2 x)}{x^2 \left (1-x+x^2\right )^2} \, dx\\ &=-\frac {3}{x \left (1-x+x^2\right )}+\int \left (-\frac {e^{2+2 x}}{x^2}+\frac {2 e^{2+2 x}}{x}+\frac {e^{2+2 x} (-1-x)}{\left (1-x+x^2\right )^2}+\frac {e^{2+2 x} (3-2 x)}{1-x+x^2}\right ) \, dx\\ &=-\frac {3}{x \left (1-x+x^2\right )}+2 \int \frac {e^{2+2 x}}{x} \, dx-\int \frac {e^{2+2 x}}{x^2} \, dx+\int \frac {e^{2+2 x} (-1-x)}{\left (1-x+x^2\right )^2} \, dx+\int \frac {e^{2+2 x} (3-2 x)}{1-x+x^2} \, dx\\ &=\frac {e^{2+2 x}}{x}-\frac {3}{x \left (1-x+x^2\right )}+2 e^2 \text {Ei}(2 x)-2 \int \frac {e^{2+2 x}}{x} \, dx+\int \left (\frac {\left (-2-\frac {4 i}{\sqrt {3}}\right ) e^{2+2 x}}{-1-i \sqrt {3}+2 x}+\frac {\left (-2+\frac {4 i}{\sqrt {3}}\right ) e^{2+2 x}}{-1+i \sqrt {3}+2 x}\right ) \, dx+\int \left (-\frac {e^{2+2 x}}{\left (1-x+x^2\right )^2}-\frac {e^{2+2 x} x}{\left (1-x+x^2\right )^2}\right ) \, dx\\ &=\frac {e^{2+2 x}}{x}-\frac {3}{x \left (1-x+x^2\right )}-\frac {1}{3} \left (2 \left (3-2 i \sqrt {3}\right )\right ) \int \frac {e^{2+2 x}}{-1+i \sqrt {3}+2 x} \, dx-\frac {1}{3} \left (2 \left (3+2 i \sqrt {3}\right )\right ) \int \frac {e^{2+2 x}}{-1-i \sqrt {3}+2 x} \, dx-\int \frac {e^{2+2 x}}{\left (1-x+x^2\right )^2} \, dx-\int \frac {e^{2+2 x} x}{\left (1-x+x^2\right )^2} \, dx\\ &=\frac {e^{2+2 x}}{x}-\frac {3}{x \left (1-x+x^2\right )}-\frac {1}{3} \left (3+2 i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )-\frac {1}{3} \left (3-2 i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )-\int \left (-\frac {2 \left (1+i \sqrt {3}\right ) e^{2+2 x}}{3 \left (1+i \sqrt {3}-2 x\right )^2}+\frac {2 i e^{2+2 x}}{3 \sqrt {3} \left (1+i \sqrt {3}-2 x\right )}-\frac {2 \left (1-i \sqrt {3}\right ) e^{2+2 x}}{3 \left (-1+i \sqrt {3}+2 x\right )^2}+\frac {2 i e^{2+2 x}}{3 \sqrt {3} \left (-1+i \sqrt {3}+2 x\right )}\right ) \, dx-\int \left (-\frac {4 e^{2+2 x}}{3 \left (1+i \sqrt {3}-2 x\right )^2}+\frac {4 i e^{2+2 x}}{3 \sqrt {3} \left (1+i \sqrt {3}-2 x\right )}-\frac {4 e^{2+2 x}}{3 \left (-1+i \sqrt {3}+2 x\right )^2}+\frac {4 i e^{2+2 x}}{3 \sqrt {3} \left (-1+i \sqrt {3}+2 x\right )}\right ) \, dx\\ &=\frac {e^{2+2 x}}{x}-\frac {3}{x \left (1-x+x^2\right )}-\frac {1}{3} \left (3+2 i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )-\frac {1}{3} \left (3-2 i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )+\frac {4}{3} \int \frac {e^{2+2 x}}{\left (1+i \sqrt {3}-2 x\right )^2} \, dx+\frac {4}{3} \int \frac {e^{2+2 x}}{\left (-1+i \sqrt {3}+2 x\right )^2} \, dx-\frac {(2 i) \int \frac {e^{2+2 x}}{1+i \sqrt {3}-2 x} \, dx}{3 \sqrt {3}}-\frac {(2 i) \int \frac {e^{2+2 x}}{-1+i \sqrt {3}+2 x} \, dx}{3 \sqrt {3}}-\frac {(4 i) \int \frac {e^{2+2 x}}{1+i \sqrt {3}-2 x} \, dx}{3 \sqrt {3}}-\frac {(4 i) \int \frac {e^{2+2 x}}{-1+i \sqrt {3}+2 x} \, dx}{3 \sqrt {3}}+\frac {1}{3} \left (2 \left (1-i \sqrt {3}\right )\right ) \int \frac {e^{2+2 x}}{\left (-1+i \sqrt {3}+2 x\right )^2} \, dx+\frac {1}{3} \left (2 \left (1+i \sqrt {3}\right )\right ) \int \frac {e^{2+2 x}}{\left (1+i \sqrt {3}-2 x\right )^2} \, dx\\ &=\frac {2 e^{2+2 x}}{3 \left (1-i \sqrt {3}-2 x\right )}+\frac {\left (1-i \sqrt {3}\right ) e^{2+2 x}}{3 \left (1-i \sqrt {3}-2 x\right )}+\frac {2 e^{2+2 x}}{3 \left (1+i \sqrt {3}-2 x\right )}+\frac {\left (1+i \sqrt {3}\right ) e^{2+2 x}}{3 \left (1+i \sqrt {3}-2 x\right )}+\frac {e^{2+2 x}}{x}-\frac {3}{x \left (1-x+x^2\right )}+\frac {i e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )}{\sqrt {3}}-\frac {1}{3} \left (3+2 i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )-\frac {i e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )}{\sqrt {3}}-\frac {1}{3} \left (3-2 i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )-\frac {4}{3} \int \frac {e^{2+2 x}}{1+i \sqrt {3}-2 x} \, dx+\frac {4}{3} \int \frac {e^{2+2 x}}{-1+i \sqrt {3}+2 x} \, dx+\frac {1}{3} \left (2 \left (1-i \sqrt {3}\right )\right ) \int \frac {e^{2+2 x}}{-1+i \sqrt {3}+2 x} \, dx-\frac {1}{3} \left (2 \left (1+i \sqrt {3}\right )\right ) \int \frac {e^{2+2 x}}{1+i \sqrt {3}-2 x} \, dx\\ &=\frac {2 e^{2+2 x}}{3 \left (1-i \sqrt {3}-2 x\right )}+\frac {\left (1-i \sqrt {3}\right ) e^{2+2 x}}{3 \left (1-i \sqrt {3}-2 x\right )}+\frac {2 e^{2+2 x}}{3 \left (1+i \sqrt {3}-2 x\right )}+\frac {\left (1+i \sqrt {3}\right ) e^{2+2 x}}{3 \left (1+i \sqrt {3}-2 x\right )}+\frac {e^{2+2 x}}{x}-\frac {3}{x \left (1-x+x^2\right )}+\frac {2}{3} e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )+\frac {i e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )}{\sqrt {3}}+\frac {1}{3} \left (1+i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )-\frac {1}{3} \left (3+2 i \sqrt {3}\right ) e^{3+i \sqrt {3}} \text {Ei}\left (-1-i \sqrt {3}+2 x\right )+\frac {2}{3} e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )-\frac {i e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )}{\sqrt {3}}+\frac {1}{3} \left (1-i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )-\frac {1}{3} \left (3-2 i \sqrt {3}\right ) e^{3-i \sqrt {3}} \text {Ei}\left (-1+i \sqrt {3}+2 x\right )\\ \end {aligned} \end {gather*}
________________________________________________________________________________________
Mathematica [A] time = 0.37, size = 23, normalized size = 1.00 \begin {gather*} \frac {-3+e^{2+2 x}}{x \left (1-x+x^2\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.80, size = 21, normalized size = 0.91 \begin {gather*} \frac {e^{\left (2 \, x + 2\right )} - 3}{x^{3} - x^{2} + x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.21, size = 21, normalized size = 0.91 \begin {gather*} \frac {e^{\left (2 \, x + 2\right )} - 3}{x^{3} - x^{2} + x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.16, size = 23, normalized size = 1.00
method | result | size |
norman | \(\frac {{\mathrm e}^{2 x +2}-3}{x \left (x^{2}-x +1\right )}\) | \(23\) |
risch | \(-\frac {3}{x \left (x^{2}-x +1\right )}+\frac {{\mathrm e}^{2 x +2}}{x \left (x^{2}-x +1\right )}\) | \(37\) |
derivativedivides | \(-\frac {18 \left (\frac {x}{3}-\frac {2}{3}\right )}{\left (x +1\right )^{2}-3 x}-\frac {3}{x}-\frac {24}{\left (x +1\right )^{2}-3 x}+\frac {9 x +9}{\left (x +1\right )^{2}-3 x}+\frac {4 \,{\mathrm e}^{2 x +2} \left (4 \left (x +1\right )^{2}-13 x -1\right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}-\frac {20 \,{\mathrm e}^{2 x +2} \left (\left (x +1\right )^{2}-4 x \right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}-\frac {11 \,{\mathrm e}^{2 x +2} \left (2 x -1\right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}+\frac {2 \,{\mathrm e}^{2 x +2} \left (x +1\right ) \left (2 x -1\right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}\) | \(196\) |
default | \(-\frac {18 \left (\frac {x}{3}-\frac {2}{3}\right )}{\left (x +1\right )^{2}-3 x}-\frac {3}{x}-\frac {24}{\left (x +1\right )^{2}-3 x}+\frac {9 x +9}{\left (x +1\right )^{2}-3 x}+\frac {4 \,{\mathrm e}^{2 x +2} \left (4 \left (x +1\right )^{2}-13 x -1\right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}-\frac {20 \,{\mathrm e}^{2 x +2} \left (\left (x +1\right )^{2}-4 x \right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}-\frac {11 \,{\mathrm e}^{2 x +2} \left (2 x -1\right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}+\frac {2 \,{\mathrm e}^{2 x +2} \left (x +1\right ) \left (2 x -1\right )}{\left (x +1\right )^{3}-4 \left (x +1\right )^{2}+6 x +3}\) | \(196\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 0.49, size = 76, normalized size = 3.30 \begin {gather*} -\frac {4 \, x^{2} - 5 \, x + 3}{x^{3} - x^{2} + x} + \frac {3 \, {\left (2 \, x - 1\right )}}{x^{2} - x + 1} - \frac {2 \, {\left (x + 1\right )}}{x^{2} - x + 1} + \frac {e^{\left (2 \, x + 2\right )}}{x^{3} - x^{2} + x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.13, size = 22, normalized size = 0.96 \begin {gather*} \frac {{\mathrm {e}}^{2\,x+2}-3}{x\,\left (x^2-x+1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.15, size = 24, normalized size = 1.04 \begin {gather*} \frac {e^{2 x + 2}}{x^{3} - x^{2} + x} - \frac {3}{x^{3} - x^{2} + x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________