Gaussian integration

1. Feb 19, 2008

Inquisitus

I'm trying to integrate the Gaussian distribution between arbitrary limits, but I'm not having a lot of luck. As far as I can see I've done it right, but the answer I get is imaginary, which is obviously wrong, since it's supposed to represent a probability

1. The problem statement, all variables and given/known data

a = 299
b = 301
β = -6.4e-6
α = sqrt(-β/π)

2. Relevant equations

3. The attempt at a solution
Steps I'm taking:
1. Turn it into a double integral over x and y
2. Transform to polar coordinates; dxdy becomes rdrdθ and the limits become the corresponding values of r and θ for x=b, x=a (do I need to do something else with the θ limits perhaps?)
3. Evaluate the r (inner) integral (with respect to r) and bring it outside the outer integral as a coefficient, since it's constant (is this part right? I'm not quite sure)
4. Evaluate the θ integral; this just becomes θ(b) - θ(a).

Here's my working:

Using this approach, I get an answer of 0.513e-5 i, which is clearly wrong (it should be around 2.84e-3).

Can anyone tell me what I'm doing wrong? :(

Last edited: Feb 19, 2008
2. Feb 19, 2008

blochwave

Seems like you're sorta forgetting a pretty important negative sign

3. Feb 19, 2008

Inquisitus

Whoops, I meant to put β = -6.4e-6 in my first post. That's what I used in the calculation, though, and it still gives me an imaginary number. Basically the minus sign that's normally in front of the x² in a Gaussian distribution is contained in β (to make the algebra simpler).

4. Feb 19, 2008

blochwave

Damn, I was hoping it'd be something simple so I wouldn't feel the compulsive need to carefully check your work >_>

Forget checking it by plugging in your numbers, everyone and their mother knows the solution when x runs from negative infinity to infinity(or 0 to infinity if you prefer the factor of 1/2)so I'm thinking actually the problem, since your work seems ok, is gonna be in those limits of integration

I'm looking at those relevant equations you listed, and I'm thinking you kinda judiciously misused y, in that r=sqrt(x^2+y^2), like you use when you make the double integral, that y doesn't refer to the given function, it's like a dummy variable. You didn't have to call it y at all, you could've called it anything, but with x and y being used it makes it glaringly obvious what variable substitution makes it doable

5. Feb 22, 2008

Inquisitus

That's one of the things I was considering, but by my understanding of the technique, you choose the dummy variable y to be the actual function that you're integrating, as this means that the polar coordinate system you transform to will correspond directly to Cartesian system that the function was defined in.

Since you only know the limits in x, you also need to know y in terms of x in order to find the limits in r and θ. Choosing the dummy variable as y = αexp(βx²) allows you to do just this.

I've only ever seen this done over (-∞,∞), which means that you don't have to worry about transforming limits in such detail, but this technique seems like it should work to give the same results.

That's my understanding of it anyway; I stand to be corrected :tongue:

Last edited: Feb 22, 2008
6. Feb 22, 2008

Defennder

This is rather irrelevant to the discussion, but what program did you use to write and display maths symbol as pictures?

7. Feb 22, 2008

blochwave

Uh..are we sure this is analytically doable? I just dug up pages and pages on this integral and the closest I could find is from 0 to a, and it can't be solved in closed form

8. Feb 22, 2008

Dick

It's not analytically doable unless you just call it the erf(x) function and then call that analytical. You can do special cases like 0 -> infinity using tricks like Inquistus is using (e.g. over an annular region in the plane) but that doesn't help you over a general interval [a,b].

9. Feb 22, 2008

Inquisitus

I guess it might not be, but even if it's not, I'd still be interested to know why my technique isn't valid.

Word 2007. I rather like the equation editor it has

10. Feb 22, 2008

Inquisitus

Right, I get it now. The reason this only works for special cases like [0,∞) is that the area beneath the curve in Cartesian coordinates happens to be equal to the area enclosed by the curve in polar coordinates. However, for an arbitrary interval [a,b], this isn't necessarily the case.

Thanks for the help!