As the Wolfram answer showed, it involves the error function, and so it can not be expressed in terms of elementary functions. You can approximate it using one of the various rules like Midpoint Rule or Simpson's Rule though...

e^-x^2 integrated is sqrt(pi). But how are you able to go from e^{-[(z-i/2)^2]} to that value in one step above? I thought it might be something like e^-(x-a)^2 is just e^-x^2 shifted to the right so has same integral with these limits. But there's an i in there which I'm sort of worrying about because I don't know anything about complex analysis.

If you could just help fill in this last query, that would make my weekend!

and I just let then the limits are still at so I get the same answer. Probably could use that same argument for any constant even if k is complex but also if it's complex like:

then I can consider a "contour integral" over a square contour which goes along the real axis, up across then down and the integral over the horizontal legs are zero so the integral over is the same as the integral over by the Residue Theorem.

and I just let then the limits are still at so I get the same answer. Probably could use that same argument for any constant even if k is complex but also if it's complex like:

then I can consider a "contour integral" over a square contour which goes along the real axis, up across then down and the integral over the horizontal legs are zero so the integral over is the same as the integral over by the Residue Theorem.

Hi

Sorry for delay in reply. Had to sleep :-) I have had a brief look at the contour integration and the residue theorem. Thanks very much for the introduction! And I do understand your explanation. I will come back to this to fill in my knowledge for sure.

Now I've got the true problem to do which is the integral of cos(2x)*normal density from -inf to inf. Should fall out in a similar way hopefully. The whole point of this is I want to verify a Monte Carlo approximation and have had a nice excursion along the way.