Click here to Skip to main content
15,895,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to create a C++ function that returns me a boolean value (true or false) if the value of the point that I check (x, y, z) approaches where the Gaussian concentrated (ie, with mean equal to) it's centered (xg, yg, zg).

I mean, center of gaussian is (10,10,5).

if the probability of the current point (x,y,z) it's greater than 0.5 (on a 0-1 range of values ​​of probability of the Gaussian) return true

else return false.

I don't know how implement a Gaussian that work in this way...can someone help me? How do this?

I'm using Visual C++ 2010.

Thanks in advance to all.
Posted
Comments
Stefan_Lang 29-Nov-13 3:22am    
This doesn't make much sense to me. In part because I'm unsure of the meaning of the terminology you use (Gaussian can be many things - Gaussian what?), and in part because you're not clear on the input space - what kind of values are x, y, z:
- continuous, or whole integers
- are the values unlimited or limited
- what are their distribution functions
- are they independend - if not we need to know the covariance functions too

Also, you calculate probabilities on the basis of distributions, not on individual values, so what do you mean by calculating the probability of a given value?
Domus1919 29-Nov-13 3:56am    
yes, in clear words, I need to check an array of points if are IN or OUT in a piece of space, that it's the center part of a gaussian centered on a point (xg,yg,zg)...the tollerance is 50% between 0 (low part) and 1 (peak of the Gaussian), at me interest that point TRUE are the ones that in coordinates are between the middle and the peak of the Gaussian.

I am not an expert, but I suppose you have to compute (that is approximate) the cumulative of the gaussian probability distribution in three dimensional space, i.e. the integral of the gaussian probability distribution in the sphere centered on the gaussian and having ray equal to the distance of your point from such center.
 
Share this answer
 
Comments
Domus1919 29-Nov-13 3:51am    
exactly..then, I have to check a point (x,y,z) if is on the gaussian sfere centered in xg,yg,zg, and if is on that sfere, return true else return false....

How can implement a gaussian function and check in this way?
CPallini 29-Nov-13 5:43am    
Well, you have to compute the 3d integral of the gaussian distribution. If I remember well, that's easier using polar coordinates.
Stefan_Lang 29-Nov-13 5:31am    
Thanks for your great solution. While rather brief, you managed to provide me with all relevant keywords to understand the actual problem ;-)
You need to know the standard deviation: for the gaussian distribution, the standard deviation tells you something about the range within which the probability of the variable rises above a certain value. E. g. if your standard deviation for variable x is 3, and the average expected value is 10, then the probability for x is > 68% for x between 10-3=7 and 10+3=13. See http://en.wikipedia.org/wiki/Normal_distribution[^]

To find the distance within which the probability is just about 50%, you need to look at the Tolerance interval, derived from the error function. See http://www.itl.nist.gov/div898/handbook/prc/section2/prc263.htm[^]. unfortunately there is no direct way to compute that value, but you can look it up in precalculated tables to be somewhere around 0.68 to 0.69 times the standard deviation. See http://www.itl.nist.gov/div898/handbook/eda/section3/eda3671.htm[^]

Extending this to two variables, you need to check on Multivariate normal distributions[^]. If the distribution functions of the variables X and Y are independend, then the resulting distribution function of the variable pair (X,Y) is just the product of the two distribution functions. The range of values with a 50% likelyhood is now an ellipse rather than an interval - see the image in the above link.

Similarly, if X, Y, and Z are independend variables, then the distribution function for the triple (X,Y,Z) is just the product of the three distribution functions. Therefore, if the standard deviations for X, Y, and Z are xs, ys, and zs respectively, then the shape of the 3D-area containing all triples with a greater than 50% likelyhood is a 3D ellipsoid with semi-axes of length xs, ys, and zs. See http://en.wikipedia.org/wiki/Ellipsoid[^]

The nice thing about this is that you don't actually need to calculate any normal function to determine whether a point is within this area - instead you can just determine directly which points lie within this ellipsoid by calculating the following value:
(X-xg)^2 / xs^2 + (Y-yg)^2 / ys^2 + (Z-zs)^2 / zs^2

For points within the ellipsoid, this value will be less than 1, for points outside it will be greater!
 
Share this answer
 
Comments
CPallini 29-Nov-13 5:41am    
5.I don't know if your assumptions (independent distrubution function) are correct for the OP, it looks they are different from mine (mine could be not correct).
Domus1919 29-Nov-13 5:50am    
I have to try it and let you know....thanks for your time..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900