listing all combinations of conditions in an experiment

2013-12-01

azim58 - listing all combinations of conditions in an experiment


Also see binary counting for all possible combinations of elements

A list of all combinations of conditions in an experiment can be
generated by letting the conditions equal variable and then using a CAS
(computer algebra system) such as wxMaxima, Yacas, or Microsoft
Mathematics to expand the polynomial.

For example, let's say we have 3 sets of 3 conditions that need to be
combined. This can be accomplished by expanding the expression:
(a+b+c)*(d+e+f)*(g+h+i)

In wxMaxima this can be accomplished with the command:
expand((a+b+c)*(d+e+f)*(g+h+i))
In Maxima you can also use the variable names in quotes directly.

In Yacas this can be accomplished with the command
ExpandBrackets((a+b+c)*(d+e+f)*(g+h+i))
to give
a*d*g+a*d*h+a*d*i+a*e*g+a*e*h+a*e*i+a*f*g+a*f*h+a*f*i+b*d*g+b*d*h+b*d*i+b*e
c*f*h+c*f*i

replacing all of the "+" with a newline yields
a*d*g
a*d*h
a*d*i
a*e*g
a*e*h
a*e*i
a*f*g
a*f*h
a*f*i
b*d*g
b*d*h
b*d*i
b*e*g
b*e*h
b*e*i
b*f*g
b*f*h
b*f*i
c*d*g
c*d*h
c*d*i
c*e*g
c*e*h
c*e*i
c*f*g
c*f*h
c*f*i

Each variable could then be replaced with a term appropriate for the
experiment. For example, for a PCR reaction with varying amounts, cycles,
and annealing temperatures the reaction might look like this:
5ng*25cy*50C
5ng*25cy*55C
5ng*25cy*60C
5ng*30cy*50C
5ng*30cy*55C
5ng*30cy*60C
5ng*35cy*50C
5ng*35cy*55C
5ng*35cy*60C
50ng*25cy*50C
50ng*25cy*55C
50ng*25cy*60C
50ng*30cy*50C
50ng*30cy*55C
50ng*30cy*60C
50ng*35cy*50C
50ng*35cy*55C
50ng*35cy*60C
100ng*25cy*50C
100ng*25cy*55C
100ng*25cy*60C
100ng*30cy*50C
100ng*30cy*55C
100ng*30cy*60C
100ng*35cy*50C
100ng*35cy*55C
100ng*35cy*60C