| Re .2:
The formula is correct; I will give an example. But first, why do you
expect to get zeroes from the function? In .0, your list shows 1s and
2s, as in { A[1], A[2] }. I wrote the function to return 1s and 2s.
If you want zeroes, it has to be changed. Also, my function will
return the combinations in a different order than you expect, but it
will return all of them correctly. If you want to change the order, I
can tinker with it somewhat.
Here is an example for C(2,*):
f(j,i) = ((i / N^(j-1)) % N) + 1
f(1,2) = ((2 / 2^(1-1)) % 2) + 1
= ((2 / 2^ 0 ) % 2) + 1
= ((2 / 1 ) % 2) + 1
= ( 2 % 2) + 1
= 0 + 1
= 1.
f(2,2) = ((2 / 2^(2-1)) % 2) + 1
= ((2 / 2^ 1 ) % 2) + 1
= ((2 / 2 ) % 2) + 1
= ( 1 % 2) + 1
= 1 + 1
= 2.
(Note that "/" represents integer division here, so that 7/2 would be 3,
not 3.5.)
-- edp
|
| <<< 2B::NOTES1:[NOTES$LIBRARY]MATH.NOTE;7 >>>
-< Mathematics at DEC >-
================================================================================
Note 1653.3 Combinatorial Cell formula 3 of 3
BEING::EDP "Always mount a scratch monkey." 33 lines 17-AUG-1992 09:08
--------------------------------------------------------------------------------
> The formula is correct; I will give an example. But first, why do you
> expect to get zeroes from the function? In .0, your list shows 1s and
> 2s, as in { A[1], A[2] }. I wrote the function to return 1s and 2s.
> If you want zeroes, it has to be changed. Also, my function will
> return the combinations in a different order than you expect, but it
> will return all of them correctly. If you want to change the order, I
> can tinker with it somewhat.
I wasn't intended for zeroes from the function. What I wanted to say (maybe
not clearly enough) was that my sample is:
{ A[1], A[2] } = { 0, 1 } where A[1]=0 and A[2]=1
I probably think that I've expressed the problem in a consfussing way.
In my equation C(i, j) = A[f(j,i)] the notation f(j,i) it only indicates
"function of i and j" with no preference in the order of i,j in f() like
in mathematics.
The equation could be written also C[i,j] = A[f(i,j)]. The only importance
(my mistake - my ommision) I meant was that i,j are indices (subscripts) in
C[i,j] and the result of f() is an index in A[].
I can't get the results when I fully expand for every C(j,i) even when
based on an incorrect problem.
f(j,i) = ((i / N^(j-1)) % N) + 1
--------------------------------
f(1,1) = ((1 / 2^(1-1)) % 2) + 1
= ((1 / 2^ 0 ) % 2) + 1
= ((1 / 1 ) % 2) + 1
= ( 1 ) % 2) + 1
= 1 + 1
= 2.
====> C(1,1) = A[f(1,1)] = A[2] = 1
f(1,2) = ((2 / 2^(1-1)) % 2) + 1
= ((2 / 2^ 0 ) % 2) + 1
= ((2 / 1 ) % 2) + 1
= ( 2 % 2) + 1
= 0 + 1
= 1.
====> C(2,1) = A[f(1,2] = A[1] = 0
f(2,1) = ((1 / 2^(2-1)) % 2) + 1
= ((1 / 2^ 1 ) % 2) + 1
= ((1 / 2 ) % 2) + 1
= ( 0 % 2) + 1
= 0 + 1
= 1.
====> C(1,2) = A[f(2,1)] = A[1]=0
f(2,2) = ((2 / 2^(2-1)) % 2) + 1
= ((2 / 2^ 1 ) % 2) + 1
= ((2 / 2 ) % 2) + 1
= ( 1 % 2) + 1
= 1 + 1
= 2.
====> C(2,2) = A[f(2,2)] = A[2] = 1
f(3,1) = ((1 / 2^(3-1)) % 2) + 1
= ((1 / 2^ 2 ) % 2) + 1
= ((1 / 4 ) % 2) + 1
= ( 0 % 2) + 1
= 0 + 1
= 1.
====> C(1,3) = A[f(3,1)] = A[1] = 0
f(3,2) = ((2 / 2^(3-1)) % 2) + 1
= ((2 / 2^ 2 ) % 2) + 1
= ((2 / 4 ) % 2) + 1
= ( 0 % 2) + 1
= 0 + 1
= 1.
====> C(2,3) = A[f(3,2)] = A[1] = 0
f(4,1) = ((1 / 2^(4-1)) % 2) + 1
= ((1 / 2^ 3 ) % 2) + 1
= ((1 / 8 ) % 2) + 1
= ( 0 % 2) + 1
= 0 + 1
= 1.
====> C(1,4) = A[f(4,1)] = A[1] = 0
f(4,2) = ((2 / 2^(4-1)) % 2) + 1
= ((2 / 2^ 3 ) % 2) + 1
= ((2 / 8 ) % 2) + 1
= ( 0 % 2) + 1
= 0 + 1
= 1.
====> C(2,4) = A[f(4,2)] = A[1] = 0
But the elements C[1,3], C[2,3], C[1,4], C[2,4] are not defined.
My array (matrix) is C 4x2, not C 2x4.
I,ve tried to interchange the role of i and j in formula i.e. f(i,j0 instead
of f(j,i). Other than starting off giving valid answers then proceeding further
for the rest of the elements it stacks with the same (unchanged) invalid tuple.
As I've tried to indicate in my discription C[i,j] grows vertically, not
horizontally. This is when I wrote:
> C(i, j) = A[f(j,i)] (what is this f(j,i) function?)
>
> where j=1,2,...,N
> i=1,2,...,N**L
and I am looking for the elements:
C(1,1) (and the result should be) = A[0] = 0
C(1,2) (and the result should be) = A[0] = 0
C(2,1) (and the result should be) = A[0] = 0
C(2,2) (and the result should be) = A[1] = 1
C(3,1) (and the result should be) = A[1] = 1
C(3,2) (and the result should be) = A[0] = 0
C(4,1) (and the result should be) = A[1] = 1
C(4,2) (and the result should be) = A[1] = 1
George
|
| Re .4:
C(1,1) = A[f(1,1)] = A[2] = 1.
C(1,2) = A[f(2,1)] = A[1] = 0.
C(2,1) = A[f(1,2)] = A[1] = 0.
C(2,2) = A[f(2,2)] = A[2] = 1.
C(3,1) = A[f(1,3)] = A[2] = 1.
C(3,2) = A[f(2,3)] = A[2] = 1.
C(4,1) = A[f(1,4)] = A[1] = 0.
C(4,2) = A[f(2,4)] = A[1] = 0.
-- edp
|