Posts Tagged ‘probability’

Combinations: General Function to Get All Possible Combinations

Thursday, February 28th, 2008

Previously, we looked at how to calculate a binomial coefficient (to find the total number of possible combinations) and an example of how to generate a list of combinations with hard-coded loops.

A function would be much more useful to us if it was flexible - if it could generate a list of combinations for any size set of numbers. We can’t do this with the hard coded loop solution, so we need to come up with a better method.
(more…)

How to Generate a List of Possible Combinations

Tuesday, February 26th, 2008

In statistics and probability, the combination is something special. There are tons of problems that revolve around how many combinations you can get choosing a certain number of random items from a set.

We’ve developed mathematical formulas to help us determine the number of possible combinations - and therefore the possibility of getting any single combination - but how can we generate a list of the actual combinations?
(more…)

Getting Combinations: Calculating a Binomial Coefficient

Sunday, February 24th, 2008

I came across this problem on the DigitalPoint forums the other day. How can we write a script to calculate the total number of random combinations in a set (i.e. the binomial coefficient), and how can we generate a list of these combinations?

Today, we’ll tackle the first part. We’ll start with a quick primer on math - what is a binomial coefficient? Then, we’ll look into the most efficient way to calculate that and get the total number of possible combinations.
(more…)