<s>[INST] Evaluating the integral $\int_{f}^{g} \exp \left[-\frac{1}{d}\left(c+b x+a x^{2}\right)\right] d x$ I am trying to evaluate the following definite integral and find an analytic solution:
\begin{equation}
\int_{f}^{g} \exp \left[-\frac{1}{d}\left(c+b x+a x^{2}\right)\right] d x
\end{equation}
I have tried looking here, but this doesn't really help. Any advice would be appreciated on finding the exact form.
 [/INST] assuming that ad>0
apply linearity
$$\int \ e^{- \frac{ax^2+bx+c}{d}  }\, dx =e^{-c/d}\int \ e^{-\frac {ax^2+bx}{d}}dx$$
now solve
$$\int \ e^{-\frac {ax^2+bx}{d}}dx=\int \ e^{-\frac {ax^2}{d}-\frac{bx}{d}}dx$$
complete the square
$$\int\ e^{-\frac {b^2} {4ad}- (\frac{ x\sqrt{a} }{ \sqrt{d} } + \frac{b}{2 \sqrt{ad} } )^2}dx$$
Substitute $$u= \frac{2ax+b}{2 \sqrt{ad} } \longrightarrow  \frac{du}{dx} = \frac{ \sqrt{a}}{ \sqrt{d} } $$
$$\Rightarrow =  \frac{ \sqrt{d\pi}e^{ \frac{b^2}{4ad} } }{2 \sqrt{a} } \int  \frac{2e^{-u^2}}{ \sqrt{\pi} } du$$
This is the Gauss Error Function $=erf(u)$
$$\therefore \frac{ \sqrt{d\pi}e^{ \frac{b^2}{4ad} } }{2 \sqrt{a} } \int  \frac{2e^{-u^2}}{ \sqrt{\pi} } du=\frac{ \sqrt{d\pi}e^{ \frac{b^2}{4ad} } erf(u)}{2 \sqrt{a} } $$
undo substitution
$$=\frac{ \sqrt{d\pi}e^{ \frac{b^2}{4ad} } erf(\frac{2ax+b}{2 \sqrt{ad}})}{2 \sqrt{a} } $$
Thus the  integral is solved
$$\Rightarrow  \int_f^g  e^{- \frac{ax^2+bx+c}{d}  }\, dx =\frac{ \sqrt{d\pi}e^{ \frac{b^2}{4ad} } erf(\frac{2ag+b}{2 \sqrt{ad}})}{2 \sqrt{a} }-\frac{ \sqrt{d\pi}e^{ \frac{b^2}{4ad} } erf(\frac{2af+b}{2 \sqrt{ad}})}{2 \sqrt{a} }$$
</s>