From: yang on
Hi,
I need your help for this problem, please.

\mathop {\sum {...\sum }}\limits_{z_r \in {Q_{2}^{*}}} such that

Q_{2}^{*}=\{(z_1,...,z_r):z_{j}=0,1,\sum_{j=1}^{r}z_{j}=\ell\}, where \ell = 0, 1, . . . , r.

For example. If r=3, \ell=1; then we are looking for triples with elements 0's or 1's and sum to 1 i.e. Q_{2}^{*}=\{(0,0,1),(0,1,0),(1,0,0)\}. So we would like to sum over theses z_r's.

I appreciate your help.
Adam
From: Roger Stafford on
"yang " <macmaster_egypt(a)yahoogroups.com> wrote in message <i1iafp$6v7$1(a)fred.mathworks.com>...
> Hi,
> I need your help for this problem, please.
>
> \mathop {\sum {...\sum }}\limits_{z_r \in {Q_{2}^{*}}} such that
>
> Q_{2}^{*}=\{(z_1,...,z_r):z_{j}=0,1,\sum_{j=1}^{r}z_{j}=\ell\}, where \ell = 0, 1, . . . , r.
>
> For example. If r=3, \ell=1; then we are looking for triples with elements 0's or 1's and sum to 1 i.e. Q_{2}^{*}=\{(0,0,1),(0,1,0),(1,0,0)\}. So we would like to sum over theses z_r's.
>
> I appreciate your help.
> Adam
- - - - - - - -
If I interpret your question correctly, for r = 5 and ell = 3, you first want all sequences of five 0's or 1's whose sum is 3:

0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 0
1 1 1 0 0

Next you want the sum of each of these columns. Is that right?

You don't need matlab for that trivial problem. The answer is always

(r-1)!/(ell-1)!/(r-ell)!

for each column. In the above case this is 4!/2!/2! = 6 which is clearly correct.

Or, if you want the sum over all elements of all sequences, it would be

r!/(ell-1)!/(r-ell)!

Roger Stafford
From: yang on
Thanks for your quick reply,

1-let us called them

> z1=( 0 0 1 1 1)
> z2=(0 1 0 1 1)
> z3=(0 1 1 0 1)
> z4=(0 1 1 1 0)
> z5=(1 0 0 1 1)
> z6=(1 0 1 0 1)
> z7=(1 0 1 1 0)
> z8=(1 1 0 0 1)
> z9=( 1 1 0 1 0)
> z10=(1 1 1 0 0)
>
How can i generate them?
then I would like to sum over z1, z2,....,z10 for something like (zi/3)+(1-zi)/8.

Thanks.
From: Roger Stafford on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message >
> You don't need matlab for that trivial problem. The answer is always
> .......
> (r-1)!/(ell-1)!/(r-ell)!
>
> for each column. In the above case this is 4!/2!/2! = 6 which is clearly correct.
>
> Or, if you want the sum over all elements of all sequences, it would be
>
> r!/(ell-1)!/(r-ell)!
> .......
- - - - - - -
I see that both those formulas fail for ell = 0. You can rewrite them as

(r-1)!*ell/ell!/(r-ell)!

and

r!*ell/ell!/(r-ell)!

respectively, to cover that case.

Roger Stafford
From: yang on
Thanks for your quick reply,

1-let us called them

> z1=( 0 0 1 1 1)
> z2=(0 1 0 1 1)
> z3=(0 1 1 0 1)
> z4=(0 1 1 1 0)
> z5=(1 0 0 1 1)
> z6=(1 0 1 0 1)
> z7=(1 0 1 1 0)
> z8=(1 1 0 0 1)
> z9=( 1 1 0 1 0)
> z10=(1 1 1 0 0)
>
How can i generate them?
then I would like to sum over z1, z2,....,z10 for something like (zi/3)+(1-zi)/8.

Thanks.