# Help with integral of a gaussian function

1. Nov 16, 2011

### maxtor101

Hi all!

I'm curious as to how one would go about actually computing this integral

$$\int_0^\pi \exp(\frac{-x^2}{2c^2})\sin(\frac{m\pi x}{2}) dx$$

I start off by using integration by parts but im unsure how to solve this integral

$$v = \int_0^\pi \exp(\frac{-x^2}{2c^2}) dx$$

Any help would be greatly appreciated
Max

2. Nov 16, 2011

### grzz

Note that $\int$exp(-ax$^{2}$)dx x $\int$exp(-ay$^{2}$)dy = $\int$$\int$exp{-a[x$^{2}$+y$^{2}$]}dxdy.

Then change to polar coordinates.

3. Nov 16, 2011

### Number Nine

Note that a lot of integrals of that form (including the normal probability density function) don't have solutions in closed form.

4. Nov 16, 2011

### Mute

I don't think the OP is doing the integral you think he's doing.

You're not really going to have much luck with that integral. Without the sine, the integral can only be expressed in terms of the error function, but the error function is defined by

$$\mbox{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x dt~e^{-t^2},$$

so you haven't gained much except that you know you can express it as the error function, which mathematica, matlab, etc., have code to compute.

If you through the sine back in there, that just makes it worse. wolframalpha calculates the integral in terms of functions related to the error function. I imagine the way it does this is to use Euler's identity and write

$$\sin x = \frac{e^{ix}-e^{-ix}}{2i},$$

and then complete the square in the exponential, but there's some trickiness associated with that because you'll be introducing imaginary numbers into the limits of the integral. That's not really a problem if you know contour integrals and complex analysis, but if you don't writing the integral that way isn't really going to help you much.