Optimal. Leaf size=128 \[ -\frac {3 e^{2 x}}{32}+\frac {1}{8} e^{2 x} x+\frac {x^2}{2}+e^x \cos (x)-e^x x \cos (x)-\frac {1}{32} e^{2 x} \cos (2 x)+e^x x \sin (x)+\frac {1}{16} e^{2 x} \cos (x) \sin (x)-\frac {1}{4} e^{2 x} x \cos (x) \sin (x)-\frac {1}{16} e^{2 x} \sin ^2(x)+\frac {1}{4} e^{2 x} x \sin ^2(x)+\frac {1}{32} e^{2 x} \sin (2 x) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps
used = 14, number of rules used = 8, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.667, Rules used = {6874, 4517,
4553, 4518, 4519, 2225, 4557, 12} \begin {gather*} \frac {x^2}{2}+\frac {1}{8} e^{2 x} x-\frac {3 e^{2 x}}{32}+\frac {1}{4} e^{2 x} x \sin ^2(x)-\frac {1}{16} e^{2 x} \sin ^2(x)+e^x x \sin (x)+\frac {1}{32} e^{2 x} \sin (2 x)-e^x x \cos (x)+e^x \cos (x)-\frac {1}{32} e^{2 x} \cos (2 x)-\frac {1}{4} e^{2 x} x \sin (x) \cos (x)+\frac {1}{16} e^{2 x} \sin (x) \cos (x) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 2225
Rule 4517
Rule 4518
Rule 4519
Rule 4553
Rule 4557
Rule 6874
Rubi steps
\begin {align*} \int x \left (1+e^x \sin (x)\right )^2 \, dx &=\int \left (x+2 e^x x \sin (x)+e^{2 x} x \sin ^2(x)\right ) \, dx\\ &=\frac {x^2}{2}+2 \int e^x x \sin (x) \, dx+\int e^{2 x} x \sin ^2(x) \, dx\\ &=\frac {1}{8} e^{2 x} x+\frac {x^2}{2}-e^x x \cos (x)+e^x x \sin (x)-\frac {1}{4} e^{2 x} x \cos (x) \sin (x)+\frac {1}{4} e^{2 x} x \sin ^2(x)-2 \int \left (-\frac {1}{2} e^x \cos (x)+\frac {1}{2} e^x \sin (x)\right ) \, dx-\int \left (\frac {e^{2 x}}{8}-\frac {1}{4} e^{2 x} \cos (x) \sin (x)+\frac {1}{4} e^{2 x} \sin ^2(x)\right ) \, dx\\ &=\frac {1}{8} e^{2 x} x+\frac {x^2}{2}-e^x x \cos (x)+e^x x \sin (x)-\frac {1}{4} e^{2 x} x \cos (x) \sin (x)+\frac {1}{4} e^{2 x} x \sin ^2(x)-\frac {1}{8} \int e^{2 x} \, dx+\frac {1}{4} \int e^{2 x} \cos (x) \sin (x) \, dx-\frac {1}{4} \int e^{2 x} \sin ^2(x) \, dx+\int e^x \cos (x) \, dx-\int e^x \sin (x) \, dx\\ &=-\frac {e^{2 x}}{16}+\frac {1}{8} e^{2 x} x+\frac {x^2}{2}+e^x \cos (x)-e^x x \cos (x)+e^x x \sin (x)+\frac {1}{16} e^{2 x} \cos (x) \sin (x)-\frac {1}{4} e^{2 x} x \cos (x) \sin (x)-\frac {1}{16} e^{2 x} \sin ^2(x)+\frac {1}{4} e^{2 x} x \sin ^2(x)-\frac {1}{16} \int e^{2 x} \, dx+\frac {1}{4} \int \frac {1}{2} e^{2 x} \sin (2 x) \, dx\\ &=-\frac {3 e^{2 x}}{32}+\frac {1}{8} e^{2 x} x+\frac {x^2}{2}+e^x \cos (x)-e^x x \cos (x)+e^x x \sin (x)+\frac {1}{16} e^{2 x} \cos (x) \sin (x)-\frac {1}{4} e^{2 x} x \cos (x) \sin (x)-\frac {1}{16} e^{2 x} \sin ^2(x)+\frac {1}{4} e^{2 x} x \sin ^2(x)+\frac {1}{8} \int e^{2 x} \sin (2 x) \, dx\\ &=-\frac {3 e^{2 x}}{32}+\frac {1}{8} e^{2 x} x+\frac {x^2}{2}+e^x \cos (x)-e^x x \cos (x)-\frac {1}{32} e^{2 x} \cos (2 x)+e^x x \sin (x)+\frac {1}{16} e^{2 x} \cos (x) \sin (x)-\frac {1}{4} e^{2 x} x \cos (x) \sin (x)-\frac {1}{16} e^{2 x} \sin ^2(x)+\frac {1}{4} e^{2 x} x \sin ^2(x)+\frac {1}{32} e^{2 x} \sin (2 x)\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.12, size = 67, normalized size = 0.52 \begin {gather*} \frac {1}{8} \left (4 x^2+e^{2 x} (-1+2 x)-8 e^x (-1+x) \cos (x)-e^{2 x} x \cos (2 x)+8 e^x x \sin (x)-e^{2 x} (-1+2 x) \cos (x) \sin (x)\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Mathics [A]
time = 3.08, size = 72, normalized size = 0.56 \begin {gather*} -\sqrt {2} x \text {Cos}\left [\frac {\text {Pi}}{4}+x\right ] E^x-\frac {\sqrt {2} x E^{2 x} \text {Sin}\left [\frac {\text {Pi}}{4}+2 x\right ]}{8}+\frac {x E^{2 x}}{4}+\frac {x^2}{2}-\frac {E^{2 x}}{8}+\frac {E^{2 x} \text {Sin}\left [2 x\right ]}{16}+\text {Cos}\left [x\right ] E^x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 63, normalized size = 0.49
method | result | size |
default | \(\frac {x^{2}}{2}+2 \left (-\frac {x}{2}+\frac {1}{2}\right ) {\mathrm e}^{x} \cos \left (x \right )+{\mathrm e}^{x} x \sin \left (x \right )+\frac {{\mathrm e}^{2 x} x}{4}-\frac {{\mathrm e}^{2 x}}{8}-\frac {x \,{\mathrm e}^{2 x} \cos \left (2 x \right )}{8}+\frac {\left (-\frac {x}{4}+\frac {1}{8}\right ) {\mathrm e}^{2 x} \sin \left (2 x \right )}{2}\) | \(63\) |
risch | \(\frac {x^{2}}{2}+\left (-\frac {1}{8}+\frac {x}{4}\right ) {\mathrm e}^{2 x}+\left (-\frac {1}{64}+\frac {i}{64}\right ) \left (-1+i+4 x \right ) {\mathrm e}^{\left (2+2 i\right ) x}+\left (-\frac {1}{4}-\frac {i}{4}\right ) \left (-1+i+2 x \right ) {\mathrm e}^{\left (1+i\right ) x}+\left (-\frac {1}{4}+\frac {i}{4}\right ) \left (-1-i+2 x \right ) {\mathrm e}^{\left (1-i\right ) x}+\left (-\frac {1}{64}-\frac {i}{64}\right ) \left (-1-i+4 x \right ) {\mathrm e}^{\left (2-2 i\right ) x}\) | \(85\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 58, normalized size = 0.45 \begin {gather*} -\frac {1}{8} \, x \cos \left (2 \, x\right ) e^{\left (2 \, x\right )} - {\left (x - 1\right )} \cos \left (x\right ) e^{x} - \frac {1}{16} \, {\left (2 \, x - 1\right )} e^{\left (2 \, x\right )} \sin \left (2 \, x\right ) + x e^{x} \sin \left (x\right ) + \frac {1}{2} \, x^{2} + \frac {1}{8} \, {\left (2 \, x - 1\right )} e^{\left (2 \, x\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.31, size = 55, normalized size = 0.43 \begin {gather*} -{\left (x - 1\right )} \cos \left (x\right ) e^{x} + \frac {1}{2} \, x^{2} - \frac {1}{8} \, {\left (2 \, x \cos \left (x\right )^{2} - 3 \, x + 1\right )} e^{\left (2 \, x\right )} - \frac {1}{8} \, {\left ({\left (2 \, x - 1\right )} \cos \left (x\right ) e^{\left (2 \, x\right )} - 8 \, x e^{x}\right )} \sin \left (x\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.72, size = 109, normalized size = 0.85 \begin {gather*} \frac {x^{2}}{2} + \frac {3 x e^{2 x} \sin ^{2}{\left (x \right )}}{8} - \frac {x e^{2 x} \sin {\left (x \right )} \cos {\left (x \right )}}{4} + \frac {x e^{2 x} \cos ^{2}{\left (x \right )}}{8} + x e^{x} \sin {\left (x \right )} - x e^{x} \cos {\left (x \right )} - \frac {e^{2 x} \sin ^{2}{\left (x \right )}}{8} + \frac {e^{2 x} \sin {\left (x \right )} \cos {\left (x \right )}}{8} - \frac {e^{2 x} \cos ^{2}{\left (x \right )}}{8} + e^{x} \cos {\left (x \right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.00, size = 71, normalized size = 0.55 \begin {gather*} \frac {1}{2} x^{2}+\mathrm {e}^{x} \left (-\frac {1}{2} \left (2 x-2\right ) \cos x+\frac {2}{2} x \sin x\right )+\frac {1}{8} \left (2 x-1\right ) \mathrm {e}^{2 x}+\mathrm {e}^{2 x} \left (-\frac {2}{16} x \cos \left (2 x\right )+\frac {1}{16} \left (-2 x+1\right ) \sin \left (2 x\right )\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.28, size = 69, normalized size = 0.54 \begin {gather*} \frac {3\,x\,{\mathrm {e}}^{2\,x}}{8}-\frac {{\mathrm {e}}^{2\,x}}{8}+{\mathrm {e}}^x\,\cos \left (x\right )+\frac {x^2}{2}-\frac {x\,{\mathrm {e}}^{2\,x}\,{\cos \left (x\right )}^2}{4}+\frac {{\mathrm {e}}^{2\,x}\,\cos \left (x\right )\,\sin \left (x\right )}{8}-x\,{\mathrm {e}}^x\,\cos \left (x\right )+x\,{\mathrm {e}}^x\,\sin \left (x\right )-\frac {x\,{\mathrm {e}}^{2\,x}\,\cos \left (x\right )\,\sin \left (x\right )}{4} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________