3.59.79 \(\int e^{-4 x-x^2} (2-10 x+2 x^3+(9-2 x^2) (i \pi +\log (6))) \, dx\) [5879]

Optimal. Leaf size=23 \[ e^{-x (4+x)} (-2+x) (i \pi -x+\log (6)) \]

[Out]

(-2+x)/exp((4+x)*x)*(ln(6)+I*Pi-x)

________________________________________________________________________________________

Rubi [C] Result contains higher order function than in optimal. Order 4 vs. order 3 in optimal.
time = 0.46, antiderivative size = 138, normalized size of antiderivative = 6.00, number of steps used = 24, number of rules used = 6, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {6873, 6874, 2272, 2266, 2236, 2273} \begin {gather*} -e^4 \sqrt {\pi } \text {Erf}(x+2)+\frac {1}{2} e^4 \sqrt {\pi } (2+9 i \pi +9 \log (6)) \text {Erf}(x+2)-\frac {9}{2} e^4 \sqrt {\pi } (\log (6)+i \pi ) \text {Erf}(x+2)-e^{-x^2-4 x} x^2+2 e^{-x^2-4 x} x+e^{-x^2-4 x} x (\log (6)+i \pi )-2 e^{-x^2-4 x} (\log (6)+i \pi ) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[E^(-4*x - x^2)*(2 - 10*x + 2*x^3 + (9 - 2*x^2)*(I*Pi + Log[6])),x]

[Out]

2*E^(-4*x - x^2)*x - E^(-4*x - x^2)*x^2 - E^4*Sqrt[Pi]*Erf[2 + x] - 2*E^(-4*x - x^2)*(I*Pi + Log[6]) + E^(-4*x
 - x^2)*x*(I*Pi + Log[6]) - (9*E^4*Sqrt[Pi]*Erf[2 + x]*(I*Pi + Log[6]))/2 + (E^4*Sqrt[Pi]*Erf[2 + x]*(2 + (9*I
)*Pi + 9*Log[6]))/2

Rule 2236

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

Rule 2266

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 2272

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 2273

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 6873

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

Rule 6874

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

Rubi steps

\begin {gather*} \begin {aligned} \text {integral} &=\int e^{-4 x-x^2} \left (2+9 i \pi -10 x+2 x^3+9 \log (6)-2 x^2 (i \pi +\log (6))\right ) \, dx\\ &=\int \left (-10 e^{-4 x-x^2} x+2 e^{-4 x-x^2} x^3-2 i e^{-4 x-x^2} x^2 (\pi -i \log (6))+2 e^{-4 x-x^2} \left (1+\frac {9}{2} (i \pi +\log (6))\right )\right ) \, dx\\ &=2 \int e^{-4 x-x^2} x^3 \, dx-10 \int e^{-4 x-x^2} x \, dx-(2 i (\pi -i \log (6))) \int e^{-4 x-x^2} x^2 \, dx+(2+9 i \pi +9 \log (6)) \int e^{-4 x-x^2} \, dx\\ &=5 e^{-4 x-x^2}-e^{-4 x-x^2} x^2+e^{-4 x-x^2} x (i \pi +\log (6))+2 \int e^{-4 x-x^2} x \, dx-4 \int e^{-4 x-x^2} x^2 \, dx+20 \int e^{-4 x-x^2} \, dx-(i \pi +\log (6)) \int e^{-4 x-x^2} \, dx+(4 (i \pi +\log (6))) \int e^{-4 x-x^2} x \, dx+\left (e^4 (2+9 i \pi +9 \log (6))\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx\\ &=4 e^{-4 x-x^2}+2 e^{-4 x-x^2} x-e^{-4 x-x^2} x^2-2 e^{-4 x-x^2} (i \pi +\log (6))+e^{-4 x-x^2} x (i \pi +\log (6))+\frac {1}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (2+9 i \pi +9 \log (6))-2 \int e^{-4 x-x^2} \, dx-4 \int e^{-4 x-x^2} \, dx+8 \int e^{-4 x-x^2} x \, dx+\left (20 e^4\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx-(8 (i \pi +\log (6))) \int e^{-4 x-x^2} \, dx-\left (e^4 (i \pi +\log (6))\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx\\ &=2 e^{-4 x-x^2} x-e^{-4 x-x^2} x^2+10 e^4 \sqrt {\pi } \text {erf}(2+x)-2 e^{-4 x-x^2} (i \pi +\log (6))+e^{-4 x-x^2} x (i \pi +\log (6))-\frac {1}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (i \pi +\log (6))+\frac {1}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (2+9 i \pi +9 \log (6))-16 \int e^{-4 x-x^2} \, dx-\left (2 e^4\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx-\left (4 e^4\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx-\left (8 e^4 (i \pi +\log (6))\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx\\ &=2 e^{-4 x-x^2} x-e^{-4 x-x^2} x^2+7 e^4 \sqrt {\pi } \text {erf}(2+x)-2 e^{-4 x-x^2} (i \pi +\log (6))+e^{-4 x-x^2} x (i \pi +\log (6))-\frac {9}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (i \pi +\log (6))+\frac {1}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (2+9 i \pi +9 \log (6))-\left (16 e^4\right ) \int e^{-\frac {1}{4} (-4-2 x)^2} \, dx\\ &=2 e^{-4 x-x^2} x-e^{-4 x-x^2} x^2-e^4 \sqrt {\pi } \text {erf}(2+x)-2 e^{-4 x-x^2} (i \pi +\log (6))+e^{-4 x-x^2} x (i \pi +\log (6))-\frac {9}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (i \pi +\log (6))+\frac {1}{2} e^4 \sqrt {\pi } \text {erf}(2+x) (2+9 i \pi +9 \log (6))\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.08, size = 24, normalized size = 1.04 \begin {gather*} -e^{-x (4+x)} (-2+x) (-i \pi +x-\log (6)) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[E^(-4*x - x^2)*(2 - 10*x + 2*x^3 + (9 - 2*x^2)*(I*Pi + Log[6])),x]

[Out]

-(((-2 + x)*((-I)*Pi + x - Log[6]))/E^(x*(4 + x)))

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 6.85, size = 109, normalized size = 4.74

method result size
norman \(\left (\left (i \pi +\ln \left (6\right )+2\right ) x -x^{2}-2 i \pi -2 \ln \left (6\right )\right ) {\mathrm e}^{-x^{2}-4 x}\) \(36\)
risch \(\left (-2 i \pi -2 \ln \left (2\right )-2 \ln \left (3\right )+i x \pi +x \ln \left (2\right )+x \ln \left (3\right )+2 x -x^{2}\right ) {\mathrm e}^{-\left (4+x \right ) x}\) \(43\)
gosper \(\left (-\frac {63}{3940225}-\frac {1984 i}{3940225}\right ) \left (1984 i x \ln \left (6\right )-63 i x \pi -1984 i x^{2}-3968 i \ln \left (6\right )+126 i \pi +3968 i x -63 x \ln \left (6\right )-1984 \pi x +63 x^{2}+126 \ln \left (6\right )+3968 \pi -126 x \right ) {\mathrm e}^{-x^{2}-4 x}\) \(70\)
default \(\frac {9 i \pi ^{\frac {3}{2}} {\mathrm e}^{4} \erf \left (2+x \right )}{2}-2 i \pi \left (-\frac {x \,{\mathrm e}^{-x^{2}-4 x}}{2}+{\mathrm e}^{-x^{2}-4 x}+\frac {9 \sqrt {\pi }\, {\mathrm e}^{4} \erf \left (2+x \right )}{4}\right )-x^{2} {\mathrm e}^{-x^{2}-4 x}+2 x \,{\mathrm e}^{-x^{2}-4 x}+\ln \left (6\right ) x \,{\mathrm e}^{-x^{2}-4 x}-2 \ln \left (6\right ) {\mathrm e}^{-x^{2}-4 x}\) \(109\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((-2*x^2+9)*(ln(6)+I*Pi)+2*x^3-10*x+2)/exp(x^2+4*x),x,method=_RETURNVERBOSE)

[Out]

9/2*I*Pi^(3/2)*exp(4)*erf(2+x)-2*I*Pi*(-1/2*x*exp(-x^2-4*x)+exp(-x^2-4*x)+9/4*Pi^(1/2)*exp(4)*erf(2+x))-x^2*ex
p(-x^2-4*x)+2*x*exp(-x^2-4*x)+ln(6)*x*exp(-x^2-4*x)-2*ln(6)*exp(-x^2-4*x)

________________________________________________________________________________________

Maxima [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.46, size = 269, normalized size = 11.70 \begin {gather*} \frac {9}{2} i \, \pi ^{\frac {3}{2}} \operatorname {erf}\left (x + 2\right ) e^{4} + \frac {9}{2} \, \sqrt {\pi } \operatorname {erf}\left (x + 2\right ) e^{4} \log \left (6\right ) + \pi {\left (\frac {i \, {\left (x + 2\right )}^{3} \Gamma \left (\frac {3}{2}, {\left (x + 2\right )}^{2}\right )}{{\left ({\left (x + 2\right )}^{2}\right )}^{\frac {3}{2}}} - \frac {4 i \, \sqrt {\pi } {\left (x + 2\right )} {\left (\operatorname {erf}\left (\sqrt {{\left (x + 2\right )}^{2}}\right ) - 1\right )}}{\sqrt {{\left (x + 2\right )}^{2}}} - 4 i \, e^{\left (-{\left (x + 2\right )}^{2}\right )}\right )} e^{4} - i \, {\left (\frac {i \, {\left (x + 2\right )}^{3} \Gamma \left (\frac {3}{2}, {\left (x + 2\right )}^{2}\right )}{{\left ({\left (x + 2\right )}^{2}\right )}^{\frac {3}{2}}} - \frac {4 i \, \sqrt {\pi } {\left (x + 2\right )} {\left (\operatorname {erf}\left (\sqrt {{\left (x + 2\right )}^{2}}\right ) - 1\right )}}{\sqrt {{\left (x + 2\right )}^{2}}} - 4 i \, e^{\left (-{\left (x + 2\right )}^{2}\right )}\right )} e^{4} \log \left (6\right ) + \sqrt {\pi } \operatorname {erf}\left (x + 2\right ) e^{4} + i \, {\left (-\frac {6 i \, {\left (x + 2\right )}^{3} \Gamma \left (\frac {3}{2}, {\left (x + 2\right )}^{2}\right )}{{\left ({\left (x + 2\right )}^{2}\right )}^{\frac {3}{2}}} + \frac {8 i \, \sqrt {\pi } {\left (x + 2\right )} {\left (\operatorname {erf}\left (\sqrt {{\left (x + 2\right )}^{2}}\right ) - 1\right )}}{\sqrt {{\left (x + 2\right )}^{2}}} + 12 i \, e^{\left (-{\left (x + 2\right )}^{2}\right )} + i \, \Gamma \left (2, {\left (x + 2\right )}^{2}\right )\right )} e^{4} - 5 i \, {\left (\frac {2 i \, \sqrt {\pi } {\left (x + 2\right )} {\left (\operatorname {erf}\left (\sqrt {{\left (x + 2\right )}^{2}}\right ) - 1\right )}}{\sqrt {{\left (x + 2\right )}^{2}}} + i \, e^{\left (-{\left (x + 2\right )}^{2}\right )}\right )} e^{4} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-2*x^2+9)*(log(6)+I*pi)+2*x^3-10*x+2)/exp(x^2+4*x),x, algorithm="maxima")

[Out]

9/2*I*pi^(3/2)*erf(x + 2)*e^4 + 9/2*sqrt(pi)*erf(x + 2)*e^4*log(6) + pi*(I*(x + 2)^3*gamma(3/2, (x + 2)^2)/((x
 + 2)^2)^(3/2) - 4*I*sqrt(pi)*(x + 2)*(erf(sqrt((x + 2)^2)) - 1)/sqrt((x + 2)^2) - 4*I*e^(-(x + 2)^2))*e^4 - I
*(I*(x + 2)^3*gamma(3/2, (x + 2)^2)/((x + 2)^2)^(3/2) - 4*I*sqrt(pi)*(x + 2)*(erf(sqrt((x + 2)^2)) - 1)/sqrt((
x + 2)^2) - 4*I*e^(-(x + 2)^2))*e^4*log(6) + sqrt(pi)*erf(x + 2)*e^4 + I*(-6*I*(x + 2)^3*gamma(3/2, (x + 2)^2)
/((x + 2)^2)^(3/2) + 8*I*sqrt(pi)*(x + 2)*(erf(sqrt((x + 2)^2)) - 1)/sqrt((x + 2)^2) + 12*I*e^(-(x + 2)^2) + I
*gamma(2, (x + 2)^2))*e^4 - 5*I*(2*I*sqrt(pi)*(x + 2)*(erf(sqrt((x + 2)^2)) - 1)/sqrt((x + 2)^2) + I*e^(-(x +
2)^2))*e^4

________________________________________________________________________________________

Fricas [A]
time = 0.39, size = 33, normalized size = 1.43 \begin {gather*} {\left (-2 i \, \pi + {\left (i \, \pi + 2\right )} x - x^{2} + {\left (x - 2\right )} \log \left (6\right )\right )} e^{\left (-x^{2} - 4 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-2*x^2+9)*(log(6)+I*pi)+2*x^3-10*x+2)/exp(x^2+4*x),x, algorithm="fricas")

[Out]

(-2*I*pi + (I*pi + 2)*x - x^2 + (x - 2)*log(6))*e^(-x^2 - 4*x)

________________________________________________________________________________________

Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 61 vs. \(2 (17) = 34\).
time = 0.19, size = 61, normalized size = 2.65 \begin {gather*} \left (- x^{2} e^{- 4 x} + x e^{- 4 x} \log {\left (6 \right )} + 2 x e^{- 4 x} + i \pi x e^{- 4 x} - 2 e^{- 4 x} \log {\left (6 \right )} - 2 i \pi e^{- 4 x}\right ) e^{- x^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-2*x**2+9)*(ln(6)+I*pi)+2*x**3-10*x+2)/exp(x**2+4*x),x)

[Out]

(-x**2*exp(-4*x) + x*exp(-4*x)*log(6) + 2*x*exp(-4*x) + I*pi*x*exp(-4*x) - 2*exp(-4*x)*log(6) - 2*I*pi*exp(-4*
x))*exp(-x**2)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 44 vs. \(2 (20) = 40\).
time = 0.39, size = 44, normalized size = 1.91 \begin {gather*} {\left (-4 i \, \pi - {\left (x + 2\right )}^{2} - \pi {\left (-i \, x - 2 i\right )} + {\left (x + 2\right )} \log \left (6\right ) + 6 \, x - 4 \, \log \left (6\right ) + 4\right )} e^{\left (-x^{2} - 4 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-2*x^2+9)*(log(6)+I*pi)+2*x^3-10*x+2)/exp(x^2+4*x),x, algorithm="giac")

[Out]

(-4*I*pi - (x + 2)^2 - pi*(-I*x - 2*I) + (x + 2)*log(6) + 6*x - 4*log(6) + 4)*e^(-x^2 - 4*x)

________________________________________________________________________________________

Mupad [B]
time = 0.14, size = 24, normalized size = 1.04 \begin {gather*} {\mathrm {e}}^{-x^2-4\,x}\,\left (x-2\right )\,\left (\ln \left (6\right )-x+\Pi \,1{}\mathrm {i}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-exp(- 4*x - x^2)*(10*x + (Pi*1i + log(6))*(2*x^2 - 9) - 2*x^3 - 2),x)

[Out]

exp(- 4*x - x^2)*(x - 2)*(Pi*1i - x + log(6))

________________________________________________________________________________________