# Solving Gaussian Integration: 0.513e-5i Wrong Answer?

• Inquisitus
In summary, the conversation discusses the attempt to integrate the Gaussian distribution between arbitrary limits, with the goal of representing a probability. The steps taken include transforming to polar coordinates and evaluating the inner and outer integrals. However, the result obtained is an imaginary number, which is incorrect. The conversation also raises the question of whether this integration is analytically doable, with the conclusion that it is not possible for a general interval [a,b].
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

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

## Homework Equations

http://img442.imageshack.us/img442/8195/croppercapture2jk3.png

## 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:

http://img208.imageshack.us/img208/5830/croppercapture6iq4.png

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 by a moderator:
Seems like you're sort of forgetting a pretty important negative sign

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).

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 going to 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

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

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

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

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

blochwave said:
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

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.

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

Word 2007. I rather like the equation editor it has

Dick said:
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].

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!

## 1. What is Gaussian integration?

Gaussian integration is a numerical method used to approximate the definite integral of a function. It involves dividing the interval of integration into smaller segments and using a weighted sum of function values within each segment to approximate the area under the curve.

## 2. Why is the answer to my Gaussian integration problem wrong?

There could be several reasons for an incorrect answer in Gaussian integration, such as using an incorrect number of segments or weights, or making a mistake in the calculation process. It is important to carefully check each step of the integration process to identify the source of the error.

## 3. How can I improve the accuracy of my Gaussian integration result?

To improve the accuracy of a Gaussian integration result, you can increase the number of segments or use more accurate weights in the calculation. You can also try using a different method of integration, such as Simpson's rule or the trapezoidal rule, to compare the results.

## 4. Can Gaussian integration be used for all types of functions?

No, Gaussian integration is most effective for functions that are smooth and continuous. It may not provide accurate results for functions with discontinuities or highly oscillatory behavior.

## 5. Is there a way to check if my Gaussian integration result is correct?

Yes, you can use the error estimation formula for Gaussian integration to estimate the error in your result. If the error is small enough, you can assume that your result is correct. You can also try using a known integral or a different method of integration to check the accuracy of your result.

• Calculus and Beyond Homework Help
Replies
1
Views
1K
• Calculus and Beyond Homework Help
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
9
Views
2K
• Calculus and Beyond Homework Help
Replies
10
Views
1K
• Calculus and Beyond Homework Help
Replies
16
Views
1K
• Calculus and Beyond Homework Help
Replies
4
Views
2K
• Calculus and Beyond Homework Help
Replies
7
Views
2K
• Calculus and Beyond Homework Help
Replies
10
Views
2K
• Calculus and Beyond Homework Help
Replies
12
Views
2K