3.433 \(\int e^{a+b x-c x^2} x^2 \, dx\)

Optimal. Leaf size=134 \[ -\frac {\sqrt {\pi } b^2 e^{a+\frac {b^2}{4 c}} \text {erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{8 c^{5/2}}-\frac {\sqrt {\pi } e^{a+\frac {b^2}{4 c}} \text {erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{4 c^{3/2}}-\frac {b e^{a+b x-c x^2}}{4 c^2}-\frac {x e^{a+b x-c x^2}}{2 c} \]

[Out]

-1/4*b*exp(-c*x^2+b*x+a)/c^2-1/2*exp(-c*x^2+b*x+a)*x/c-1/8*b^2*exp(a+1/4/c*b^2)*erf(1/2*(-2*c*x+b)/c^(1/2))*Pi
^(1/2)/c^(5/2)-1/4*exp(a+1/4/c*b^2)*erf(1/2*(-2*c*x+b)/c^(1/2))*Pi^(1/2)/c^(3/2)

________________________________________________________________________________________

Rubi [A]  time = 0.08, antiderivative size = 134, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {2241, 2240, 2234, 2205} \[ -\frac {\sqrt {\pi } b^2 e^{a+\frac {b^2}{4 c}} \text {Erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{8 c^{5/2}}-\frac {\sqrt {\pi } e^{a+\frac {b^2}{4 c}} \text {Erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{4 c^{3/2}}-\frac {b e^{a+b x-c x^2}}{4 c^2}-\frac {x e^{a+b x-c x^2}}{2 c} \]

Antiderivative was successfully verified.

[In]

Int[E^(a + b*x - c*x^2)*x^2,x]

[Out]

-(b*E^(a + b*x - c*x^2))/(4*c^2) - (E^(a + b*x - c*x^2)*x)/(2*c) - (b^2*E^(a + b^2/(4*c))*Sqrt[Pi]*Erf[(b - 2*
c*x)/(2*Sqrt[c])])/(8*c^(5/2)) - (E^(a + b^2/(4*c))*Sqrt[Pi]*Erf[(b - 2*c*x)/(2*Sqrt[c])])/(4*c^(3/2))

Rule 2205

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 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]

Rubi steps

\begin {align*} \int e^{a+b x-c x^2} x^2 \, dx &=-\frac {e^{a+b x-c x^2} x}{2 c}+\frac {\int e^{a+b x-c x^2} \, dx}{2 c}+\frac {b \int e^{a+b x-c x^2} x \, dx}{2 c}\\ &=-\frac {b e^{a+b x-c x^2}}{4 c^2}-\frac {e^{a+b x-c x^2} x}{2 c}+\frac {b^2 \int e^{a+b x-c x^2} \, dx}{4 c^2}+\frac {e^{a+\frac {b^2}{4 c}} \int e^{-\frac {(b-2 c x)^2}{4 c}} \, dx}{2 c}\\ &=-\frac {b e^{a+b x-c x^2}}{4 c^2}-\frac {e^{a+b x-c x^2} x}{2 c}-\frac {e^{a+\frac {b^2}{4 c}} \sqrt {\pi } \text {erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{4 c^{3/2}}+\frac {\left (b^2 e^{a+\frac {b^2}{4 c}}\right ) \int e^{-\frac {(b-2 c x)^2}{4 c}} \, dx}{4 c^2}\\ &=-\frac {b e^{a+b x-c x^2}}{4 c^2}-\frac {e^{a+b x-c x^2} x}{2 c}-\frac {b^2 e^{a+\frac {b^2}{4 c}} \sqrt {\pi } \text {erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{8 c^{5/2}}-\frac {e^{a+\frac {b^2}{4 c}} \sqrt {\pi } \text {erf}\left (\frac {b-2 c x}{2 \sqrt {c}}\right )}{4 c^{3/2}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.12, size = 79, normalized size = 0.59 \[ \frac {e^a \left (\sqrt {\pi } \left (b^2+2 c\right ) e^{\frac {b^2}{4 c}} \text {erf}\left (\frac {2 c x-b}{2 \sqrt {c}}\right )-2 \sqrt {c} e^{x (b-c x)} (b+2 c x)\right )}{8 c^{5/2}} \]

Antiderivative was successfully verified.

[In]

Integrate[E^(a + b*x - c*x^2)*x^2,x]

[Out]

(E^a*(-2*Sqrt[c]*E^(x*(b - c*x))*(b + 2*c*x) + (b^2 + 2*c)*E^(b^2/(4*c))*Sqrt[Pi]*Erf[(-b + 2*c*x)/(2*Sqrt[c])
]))/(8*c^(5/2))

________________________________________________________________________________________

fricas [A]  time = 0.39, size = 72, normalized size = 0.54 \[ \frac {\sqrt {\pi } {\left (b^{2} + 2 \, c\right )} \sqrt {c} \operatorname {erf}\left (\frac {2 \, c x - b}{2 \, \sqrt {c}}\right ) e^{\left (\frac {b^{2} + 4 \, a c}{4 \, c}\right )} - 2 \, {\left (2 \, c^{2} x + b c\right )} e^{\left (-c x^{2} + b x + a\right )}}{8 \, c^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(-c*x^2+b*x+a)*x^2,x, algorithm="fricas")

[Out]

1/8*(sqrt(pi)*(b^2 + 2*c)*sqrt(c)*erf(1/2*(2*c*x - b)/sqrt(c))*e^(1/4*(b^2 + 4*a*c)/c) - 2*(2*c^2*x + b*c)*e^(
-c*x^2 + b*x + a))/c^3

________________________________________________________________________________________

giac [A]  time = 0.29, size = 80, normalized size = 0.60 \[ -\frac {\frac {\sqrt {\pi } {\left (b^{2} + 2 \, c\right )} \operatorname {erf}\left (-\frac {1}{2} \, \sqrt {c} {\left (2 \, x - \frac {b}{c}\right )}\right ) e^{\left (\frac {b^{2} + 4 \, a c}{4 \, c}\right )}}{\sqrt {c}} + 2 \, {\left (c {\left (2 \, x - \frac {b}{c}\right )} + 2 \, b\right )} e^{\left (-c x^{2} + b x + a\right )}}{8 \, c^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(-c*x^2+b*x+a)*x^2,x, algorithm="giac")

[Out]

-1/8*(sqrt(pi)*(b^2 + 2*c)*erf(-1/2*sqrt(c)*(2*x - b/c))*e^(1/4*(b^2 + 4*a*c)/c)/sqrt(c) + 2*(c*(2*x - b/c) +
2*b)*e^(-c*x^2 + b*x + a))/c^2

________________________________________________________________________________________

maple [A]  time = 0.02, size = 111, normalized size = 0.83 \[ -\frac {x \,{\mathrm e}^{-c \,x^{2}+b x +a}}{2 c}-\frac {\sqrt {\pi }\, \erf \left (-\sqrt {c}\, x +\frac {b}{2 \sqrt {c}}\right ) {\mathrm e}^{a +\frac {b^{2}}{4 c}}}{4 c^{\frac {3}{2}}}+\frac {\left (-\frac {\sqrt {\pi }\, b \erf \left (-\sqrt {c}\, x +\frac {b}{2 \sqrt {c}}\right ) {\mathrm e}^{a +\frac {b^{2}}{4 c}}}{4 c^{\frac {3}{2}}}-\frac {{\mathrm e}^{-c \,x^{2}+b x +a}}{2 c}\right ) b}{2 c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(exp(-c*x^2+b*x+a)*x^2,x)

[Out]

-1/2/c*x*exp(-c*x^2+b*x+a)+1/2*b/c*(-1/2/c*exp(-c*x^2+b*x+a)-1/4*b/c^(3/2)*Pi^(1/2)*exp(a+1/4*b^2/c)*erf(-c^(1
/2)*x+1/2*b/c^(1/2)))-1/4/c^(3/2)*Pi^(1/2)*exp(a+1/4*b^2/c)*erf(-c^(1/2)*x+1/2*b/c^(1/2))

________________________________________________________________________________________

maxima [A]  time = 2.13, size = 151, normalized size = 1.13 \[ -\frac {{\left (\frac {\sqrt {\pi } {\left (2 \, c x - b\right )} b^{2} {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {\frac {{\left (2 \, c x - b\right )}^{2}}{c}}\right ) - 1\right )}}{\sqrt {\frac {{\left (2 \, c x - b\right )}^{2}}{c}} \left (-c\right )^{\frac {5}{2}}} - \frac {4 \, b c e^{\left (-\frac {{\left (2 \, c x - b\right )}^{2}}{4 \, c}\right )}}{\left (-c\right )^{\frac {5}{2}}} - \frac {4 \, {\left (2 \, c x - b\right )}^{3} \Gamma \left (\frac {3}{2}, \frac {{\left (2 \, c x - b\right )}^{2}}{4 \, c}\right )}{\left (\frac {{\left (2 \, c x - b\right )}^{2}}{c}\right )^{\frac {3}{2}} \left (-c\right )^{\frac {5}{2}}}\right )} e^{\left (a + \frac {b^{2}}{4 \, c}\right )}}{8 \, \sqrt {-c}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(-c*x^2+b*x+a)*x^2,x, algorithm="maxima")

[Out]

-1/8*(sqrt(pi)*(2*c*x - b)*b^2*(erf(1/2*sqrt((2*c*x - b)^2/c)) - 1)/(sqrt((2*c*x - b)^2/c)*(-c)^(5/2)) - 4*b*c
*e^(-1/4*(2*c*x - b)^2/c)/(-c)^(5/2) - 4*(2*c*x - b)^3*gamma(3/2, 1/4*(2*c*x - b)^2/c)/(((2*c*x - b)^2/c)^(3/2
)*(-c)^(5/2)))*e^(a + 1/4*b^2/c)/sqrt(-c)

________________________________________________________________________________________

mupad [B]  time = 3.72, size = 80, normalized size = 0.60 \[ \frac {\sqrt {\pi }\,\mathrm {erfi}\left (\frac {\frac {b}{2}-c\,x}{\sqrt {-c}}\right )\,{\mathrm {e}}^{a+\frac {b^2}{4\,c}}\,\left (b^2+2\,c\right )}{8\,{\left (-c\right )}^{5/2}}-\frac {x\,{\mathrm {e}}^{-c\,x^2+b\,x+a}}{2\,c}-\frac {b\,{\mathrm {e}}^{-c\,x^2+b\,x+a}}{4\,c^2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*exp(a + b*x - c*x^2),x)

[Out]

(pi^(1/2)*erfi((b/2 - c*x)/(-c)^(1/2))*exp(a + b^2/(4*c))*(2*c + b^2))/(8*(-c)^(5/2)) - (x*exp(a + b*x - c*x^2
))/(2*c) - (b*exp(a + b*x - c*x^2))/(4*c^2)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ e^{a} \int x^{2} e^{b x} e^{- c x^{2}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(-c*x**2+b*x+a)*x**2,x)

[Out]

exp(a)*Integral(x**2*exp(b*x)*exp(-c*x**2), x)

________________________________________________________________________________________