3.2.54 \(\int \frac {e^{x+x^2} (4 x+2 x^3-4 x^4+e^x (-2 x-x^2+2 x^4)+(-1-x-x^2+2 x^3) \log (4))}{1-2 x+x^2} \, dx\)

Optimal. Leaf size=25 \[ \frac {e^{x+x^2} x \left (-2 x+e^x x+\log (4)\right )}{-1+x} \]

________________________________________________________________________________________

Rubi [B]  time = 1.85, antiderivative size = 109, normalized size of antiderivative = 4.36, number of steps used = 51, number of rules used = 8, integrand size = 68, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {27, 6742, 2242, 2234, 2204, 2240, 2241, 2288} \begin {gather*} -2 e^{x^2+x} x+e^{x^2+2 x} x-2 e^{x^2+x}+e^{x^2+2 x}+\frac {2 e^{x^2+x}}{1-x}-\frac {e^{x^2+2 x}}{1-x}-\frac {e^{x^2+x} \left (-2 x^3+x^2+x\right ) \log (4)}{(1-x)^2 (2 x+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(E^(x + x^2)*(4*x + 2*x^3 - 4*x^4 + E^x*(-2*x - x^2 + 2*x^4) + (-1 - x - x^2 + 2*x^3)*Log[4]))/(1 - 2*x +
x^2),x]

[Out]

-2*E^(x + x^2) + E^(2*x + x^2) + (2*E^(x + x^2))/(1 - x) - E^(2*x + x^2)/(1 - x) - 2*E^(x + x^2)*x + E^(2*x +
x^2)*x - (E^(x + x^2)*(x + x^2 - 2*x^3)*Log[4])/((1 - x)^2*(1 + 2*x))

Rule 27

Int[(u_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[u*Cancel[(b/2 + c*x)^(2*p)/c^p], x] /; Fr
eeQ[{a, b, c}, x] && EqQ[b^2 - 4*a*c, 0] && IntegerQ[p]

Rule 2204

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[(F^a*Sqrt[Pi]*Erfi[(c + d*x)*Rt[b*Log[F], 2
]])/(2*d*Rt[b*Log[F], 2]), x] /; FreeQ[{F, a, b, c, d}, x] && PosQ[b]

Rule 2234

Int[(F_)^((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[F^(a - b^2/(4*c)), Int[F^((b + 2*c*x)^2/(4*c))
, x], x] /; FreeQ[{F, a, b, c}, x]

Rule 2240

Int[(F_)^((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[(e*F^(a + b*x + c*x^2))/(
2*c*Log[F]), x] - Dist[(b*e - 2*c*d)/(2*c), Int[F^(a + b*x + c*x^2), x], x] /; FreeQ[{F, a, b, c, d, e}, x] &&
 NeQ[b*e - 2*c*d, 0]

Rule 2241

Int[(F_)^((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_.) + (e_.)*(x_))^(m_), x_Symbol] :> Simp[(e*(d + e*x)^(m - 1)
*F^(a + b*x + c*x^2))/(2*c*Log[F]), x] + (-Dist[(b*e - 2*c*d)/(2*c), Int[(d + e*x)^(m - 1)*F^(a + b*x + c*x^2)
, x], x] - Dist[((m - 1)*e^2)/(2*c*Log[F]), Int[(d + e*x)^(m - 2)*F^(a + b*x + c*x^2), x], x]) /; FreeQ[{F, a,
 b, c, d, e}, x] && NeQ[b*e - 2*c*d, 0] && GtQ[m, 1]

Rule 2242

Int[(F_)^((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_.) + (e_.)*(x_))^(m_), x_Symbol] :> Simp[((d + e*x)^(m + 1)*F
^(a + b*x + c*x^2))/(e*(m + 1)), x] + (-Dist[(2*c*Log[F])/(e^2*(m + 1)), Int[(d + e*x)^(m + 2)*F^(a + b*x + c*
x^2), x], x] - Dist[((b*e - 2*c*d)*Log[F])/(e^2*(m + 1)), Int[(d + e*x)^(m + 1)*F^(a + b*x + c*x^2), x], x]) /
; FreeQ[{F, a, b, c, d, e}, x] && NeQ[b*e - 2*c*d, 0] && LtQ[m, -1]

Rule 2288

Int[(y_.)*(F_)^(u_)*((v_) + (w_)), x_Symbol] :> With[{z = (v*y)/(Log[F]*D[u, x])}, Simp[F^u*z, x] /; EqQ[D[z,
x], w*y]] /; FreeQ[F, x]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {e^{x+x^2} \left (4 x+2 x^3-4 x^4+e^x \left (-2 x-x^2+2 x^4\right )+\left (-1-x-x^2+2 x^3\right ) \log (4)\right )}{(-1+x)^2} \, dx\\ &=\int \left (\frac {4 e^{x+x^2} x}{(-1+x)^2}+\frac {2 e^{x+x^2} x^3}{(-1+x)^2}-\frac {4 e^{x+x^2} x^4}{(-1+x)^2}+\frac {e^{2 x+x^2} x \left (-2-x+2 x^3\right )}{(-1+x)^2}+\frac {e^{x+x^2} \left (-1-x-x^2+2 x^3\right ) \log (4)}{(-1+x)^2}\right ) \, dx\\ &=2 \int \frac {e^{x+x^2} x^3}{(-1+x)^2} \, dx+4 \int \frac {e^{x+x^2} x}{(-1+x)^2} \, dx-4 \int \frac {e^{x+x^2} x^4}{(-1+x)^2} \, dx+\log (4) \int \frac {e^{x+x^2} \left (-1-x-x^2+2 x^3\right )}{(-1+x)^2} \, dx+\int \frac {e^{2 x+x^2} x \left (-2-x+2 x^3\right )}{(-1+x)^2} \, dx\\ &=-\frac {e^{x+x^2} \left (x+x^2-2 x^3\right ) \log (4)}{(1-x)^2 (1+2 x)}+2 \int \left (2 e^{x+x^2}+\frac {e^{x+x^2}}{(-1+x)^2}+\frac {3 e^{x+x^2}}{-1+x}+e^{x+x^2} x\right ) \, dx+4 \int \left (\frac {e^{x+x^2}}{(-1+x)^2}+\frac {e^{x+x^2}}{-1+x}\right ) \, dx-4 \int \left (3 e^{x+x^2}+\frac {e^{x+x^2}}{(-1+x)^2}+\frac {4 e^{x+x^2}}{-1+x}+2 e^{x+x^2} x+e^{x+x^2} x^2\right ) \, dx+\int \left (5 e^{2 x+x^2}-\frac {e^{2 x+x^2}}{(-1+x)^2}+\frac {4 e^{2 x+x^2}}{-1+x}+4 e^{2 x+x^2} x+2 e^{2 x+x^2} x^2\right ) \, dx\\ &=-\frac {e^{x+x^2} \left (x+x^2-2 x^3\right ) \log (4)}{(1-x)^2 (1+2 x)}+2 \int \frac {e^{x+x^2}}{(-1+x)^2} \, dx+2 \int e^{x+x^2} x \, dx+2 \int e^{2 x+x^2} x^2 \, dx+4 \int e^{x+x^2} \, dx+4 \int \frac {e^{x+x^2}}{-1+x} \, dx+4 \int \frac {e^{2 x+x^2}}{-1+x} \, dx+4 \int e^{2 x+x^2} x \, dx-4 \int e^{x+x^2} x^2 \, dx+5 \int e^{2 x+x^2} \, dx+6 \int \frac {e^{x+x^2}}{-1+x} \, dx-8 \int e^{x+x^2} x \, dx-12 \int e^{x+x^2} \, dx-16 \int \frac {e^{x+x^2}}{-1+x} \, dx-\int \frac {e^{2 x+x^2}}{(-1+x)^2} \, dx\\ &=-3 e^{x+x^2}+2 e^{2 x+x^2}+\frac {2 e^{x+x^2}}{1-x}-\frac {e^{2 x+x^2}}{1-x}-2 e^{x+x^2} x+e^{2 x+x^2} x-\frac {e^{x+x^2} \left (x+x^2-2 x^3\right ) \log (4)}{(1-x)^2 (1+2 x)}+2 \int e^{x+x^2} \, dx-2 \int e^{2 x+x^2} \, dx+2 \int e^{x+x^2} x \, dx-2 \int e^{2 x+x^2} x \, dx+2 \left (4 \int e^{x+x^2} \, dx\right )-4 \int e^{2 x+x^2} \, dx+4 \int \frac {e^{x+x^2}}{-1+x} \, dx+2 \left (6 \int \frac {e^{x+x^2}}{-1+x} \, dx\right )-16 \int \frac {e^{x+x^2}}{-1+x} \, dx+\frac {5 \int e^{\frac {1}{4} (2+2 x)^2} \, dx}{e}+\frac {4 \int e^{\frac {1}{4} (1+2 x)^2} \, dx}{\sqrt [4]{e}}-\frac {12 \int e^{\frac {1}{4} (1+2 x)^2} \, dx}{\sqrt [4]{e}}-\int e^{x+x^2} \, dx-\int e^{2 x+x^2} \, dx\\ &=-2 e^{x+x^2}+e^{2 x+x^2}+\frac {2 e^{x+x^2}}{1-x}-\frac {e^{2 x+x^2}}{1-x}-2 e^{x+x^2} x+e^{2 x+x^2} x+\frac {5 \sqrt {\pi } \text {erfi}(1+x)}{2 e}-\frac {4 \sqrt {\pi } \text {erfi}\left (\frac {1}{2} (1+2 x)\right )}{\sqrt [4]{e}}-\frac {e^{x+x^2} \left (x+x^2-2 x^3\right ) \log (4)}{(1-x)^2 (1+2 x)}+2 \int e^{2 x+x^2} \, dx+4 \int \frac {e^{x+x^2}}{-1+x} \, dx+2 \left (6 \int \frac {e^{x+x^2}}{-1+x} \, dx\right )-16 \int \frac {e^{x+x^2}}{-1+x} \, dx-\frac {\int e^{\frac {1}{4} (2+2 x)^2} \, dx}{e}-\frac {2 \int e^{\frac {1}{4} (2+2 x)^2} \, dx}{e}-\frac {4 \int e^{\frac {1}{4} (2+2 x)^2} \, dx}{e}-\frac {\int e^{\frac {1}{4} (1+2 x)^2} \, dx}{\sqrt [4]{e}}+\frac {2 \int e^{\frac {1}{4} (1+2 x)^2} \, dx}{\sqrt [4]{e}}+2 \frac {4 \int e^{\frac {1}{4} (1+2 x)^2} \, dx}{\sqrt [4]{e}}-\int e^{x+x^2} \, dx\\ &=-2 e^{x+x^2}+e^{2 x+x^2}+\frac {2 e^{x+x^2}}{1-x}-\frac {e^{2 x+x^2}}{1-x}-2 e^{x+x^2} x+e^{2 x+x^2} x-\frac {\sqrt {\pi } \text {erfi}(1+x)}{e}+\frac {\sqrt {\pi } \text {erfi}\left (\frac {1}{2} (1+2 x)\right )}{2 \sqrt [4]{e}}-\frac {e^{x+x^2} \left (x+x^2-2 x^3\right ) \log (4)}{(1-x)^2 (1+2 x)}+4 \int \frac {e^{x+x^2}}{-1+x} \, dx+2 \left (6 \int \frac {e^{x+x^2}}{-1+x} \, dx\right )-16 \int \frac {e^{x+x^2}}{-1+x} \, dx+\frac {2 \int e^{\frac {1}{4} (2+2 x)^2} \, dx}{e}-\frac {\int e^{\frac {1}{4} (1+2 x)^2} \, dx}{\sqrt [4]{e}}\\ &=-2 e^{x+x^2}+e^{2 x+x^2}+\frac {2 e^{x+x^2}}{1-x}-\frac {e^{2 x+x^2}}{1-x}-2 e^{x+x^2} x+e^{2 x+x^2} x-\frac {e^{x+x^2} \left (x+x^2-2 x^3\right ) \log (4)}{(1-x)^2 (1+2 x)}+4 \int \frac {e^{x+x^2}}{-1+x} \, dx+2 \left (6 \int \frac {e^{x+x^2}}{-1+x} \, dx\right )-16 \int \frac {e^{x+x^2}}{-1+x} \, dx\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]  time = 0.82, size = 24, normalized size = 0.96 \begin {gather*} \frac {e^{x+x^2} x \left (\left (-2+e^x\right ) x+\log (4)\right )}{-1+x} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(E^(x + x^2)*(4*x + 2*x^3 - 4*x^4 + E^x*(-2*x - x^2 + 2*x^4) + (-1 - x - x^2 + 2*x^3)*Log[4]))/(1 -
2*x + x^2),x]

[Out]

(E^(x + x^2)*x*((-2 + E^x)*x + Log[4]))/(-1 + x)

________________________________________________________________________________________

fricas [A]  time = 0.76, size = 29, normalized size = 1.16 \begin {gather*} \frac {{\left (x^{2} e^{x} - 2 \, x^{2} + 2 \, x \log \relax (2)\right )} e^{\left (x^{2} + x\right )}}{x - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((2*x^4-x^2-2*x)*exp(x)+2*(2*x^3-x^2-x-1)*log(2)-4*x^4+2*x^3+4*x)*exp(x^2+x)/(x^2-2*x+1),x, algorith
m="fricas")

[Out]

(x^2*e^x - 2*x^2 + 2*x*log(2))*e^(x^2 + x)/(x - 1)

________________________________________________________________________________________

giac [A]  time = 0.31, size = 41, normalized size = 1.64 \begin {gather*} \frac {x^{2} e^{\left (x^{2} + 2 \, x\right )} - 2 \, x^{2} e^{\left (x^{2} + x\right )} + 2 \, x e^{\left (x^{2} + x\right )} \log \relax (2)}{x - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((2*x^4-x^2-2*x)*exp(x)+2*(2*x^3-x^2-x-1)*log(2)-4*x^4+2*x^3+4*x)*exp(x^2+x)/(x^2-2*x+1),x, algorith
m="giac")

[Out]

(x^2*e^(x^2 + 2*x) - 2*x^2*e^(x^2 + x) + 2*x*e^(x^2 + x)*log(2))/(x - 1)

________________________________________________________________________________________

maple [A]  time = 0.12, size = 26, normalized size = 1.04




method result size



risch \(\frac {\left (2 \ln \relax (2)-2 x +{\mathrm e}^{x} x \right ) {\mathrm e}^{\left (x +1\right ) x} x}{x -1}\) \(26\)
norman \(\frac {{\mathrm e}^{x} x^{2} {\mathrm e}^{x^{2}+x}-2 x^{2} {\mathrm e}^{x^{2}+x}+2 x \ln \relax (2) {\mathrm e}^{x^{2}+x}}{x -1}\) \(42\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((2*x^4-x^2-2*x)*exp(x)+2*(2*x^3-x^2-x-1)*ln(2)-4*x^4+2*x^3+4*x)*exp(x^2+x)/(x^2-2*x+1),x,method=_RETURNVE
RBOSE)

[Out]

(2*ln(2)-2*x+exp(x)*x)*exp((x+1)*x)*x/(x-1)

________________________________________________________________________________________

maxima [A]  time = 0.62, size = 32, normalized size = 1.28 \begin {gather*} \frac {{\left (x^{2} e^{\left (2 \, x\right )} - 2 \, {\left (x^{2} - x \log \relax (2)\right )} e^{x}\right )} e^{\left (x^{2}\right )}}{x - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((2*x^4-x^2-2*x)*exp(x)+2*(2*x^3-x^2-x-1)*log(2)-4*x^4+2*x^3+4*x)*exp(x^2+x)/(x^2-2*x+1),x, algorith
m="maxima")

[Out]

(x^2*e^(2*x) - 2*(x^2 - x*log(2))*e^x)*e^(x^2)/(x - 1)

________________________________________________________________________________________

mupad [B]  time = 0.44, size = 40, normalized size = 1.60 \begin {gather*} \frac {x^2\,{\mathrm {e}}^{x^2+2\,x}-2\,x^2\,{\mathrm {e}}^{x^2+x}+x\,{\mathrm {e}}^{x^2+x}\,\ln \relax (4)}{x-1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(exp(x + x^2)*(exp(x)*(2*x + x^2 - 2*x^4) - 4*x + 2*log(2)*(x + x^2 - 2*x^3 + 1) - 2*x^3 + 4*x^4))/(x^2 -
 2*x + 1),x)

[Out]

(x^2*exp(2*x + x^2) - 2*x^2*exp(x + x^2) + x*exp(x + x^2)*log(4))/(x - 1)

________________________________________________________________________________________

sympy [A]  time = 0.23, size = 27, normalized size = 1.08 \begin {gather*} \frac {\left (x^{2} e^{x} - 2 x^{2} + 2 x \log {\relax (2 )}\right ) e^{x^{2} + x}}{x - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((2*x**4-x**2-2*x)*exp(x)+2*(2*x**3-x**2-x-1)*ln(2)-4*x**4+2*x**3+4*x)*exp(x**2+x)/(x**2-2*x+1),x)

[Out]

(x**2*exp(x) - 2*x**2 + 2*x*log(2))*exp(x**2 + x)/(x - 1)

________________________________________________________________________________________