# Combine n Gaussian Probability Sets in a limited float range

I've got a fixed solution space defined by a minimum and maximum float which has no divisible slice.

You then have 0..N Gaussian distribution probability sets which I need to combine.

In the end I neeed

1. Method to define probability set with a numeric range (not sliceable) and 0..N Gaussian functions
2. A function which can generate a random number in the range as defined by the calculated probabilities.

Also I know it is possible that some combinations will generate a zero solution space.

Now I'm thinking the way to do it is take the normalised probability density functions and multiply them to get a new space then normalising the result. I just can't seem to break it down into algorithmic form.

Any ideas?

• You would probably be better off asking this at math.stackexchange.com? Commented Aug 15, 2010 at 10:59
• I thought about that, but I'm mostly concerned with how to do it algorithmically. A pure maths solution would help but not be the answer. Commented Aug 15, 2010 at 11:05
• Then maybe try stackoverflow.com? It looks like a generic programming problem, I don't see the word "game" in your post anywhere (not that it's a requirement but that's a pretty good sign that you might want to look elsewhere) Commented Aug 15, 2010 at 15:41
• I need help with some terms, like no divible slice, zero solution space, normalized probility density. Commented Aug 15, 2010 at 16:20
• Hmm. the top hit for "divisible slice" on google is this question. Then a number of documents where "divisible" and "slice" occur next to each other, but are part of different sentences. You might want to explain that one, as it's obviously not uniform usage. Commented Aug 16, 2010 at 7:45

First let's make sure I understood your question correctly:

• You have a probability function that is expressed as a sum of N parametrized one-dimensional gaussians, each with different mean and standard deviation.
• You want to generate stochastic variables according to this distribution.

Is this correct?

If this is the case, I reccommend you use a variation of rejection sampling. The recipe is quite straightforward, but you might have to iterate a bit before you get an answer out of it. This is the basic outline.

1. You generate a uniformly distributed random number in your desired interval, x.
2. You calculate the value of your probability distribution, p(x)
3. You generate another uniformly distributed random number between 0 and 1, q
4. If q < p(x), return x
5. If not, start from step 1.

No matter how large the temptation, do not re-use q for different iterations.

• I cannot use this method because as I stated a floating range is non-divisible (not sliceable). So sampling is impossible. I already use this method for enumerations which are possible to sample. Also I've taken advice and moved this question to Math Stack math.stackexchange.com/questions/2584/… Commented Aug 21, 2010 at 8:13
• Ok, let's move there. Commented Aug 21, 2010 at 15:53