Is there a way to iterate through a set?

1.7k Views Asked by At

I have a set $X=\{x_1,x_2,...x_n\}$ and I want to define a function: $$f(X)=\prod_{j=1}^n{\sum_{i=j}^nx_i \choose x_j}$$

However, in this function I'm treating this set as a sequence, as sets don't have a particular order. The problem is that I can't think of a way of working around this, without having to define the sequence (which I'm also not sure how to do, as these elements don't have any inherit order). In addition the output of the function is invariant of the order of $x_1,x_2,...x_n$.

Is there a workaround to this situation, allowing me to iterate through the set?

One idea I had is to use the form: $$f(X)=\prod_{x_i\in{X}}{?? \choose x_i}$$ But I don't know how I would express the top part of the binomial coefficient, as it depends on all of the other elements before.

Any help is appreciated.

2

There are 2 best solutions below

0
On

If the output of the function is indeed independent of the order, just use your first expression and write explicitly that the order does not matter. Note that your formula already implies using an order because the upper argument adds up only the elements comping after the one in the lower argument.

If the result does depend on the order, you'll not be able to avoid explicitly specifying the order.

Alternatively, you could define your function recursively: \begin{aligned} f(\emptyset) &= 1\\ f(X\cup\{a\}) &= f(X)\times{a+\sum_{x\in X}x \choose a} \text{ where } a\notin X \end{aligned} Of course this is only well-defined if your function really does not depend on the order.

0
On

It sounds to me that $f(X)$ is a product of terms where each term individually depends on the order of the sequence, but where the product itself does not.

As such, you will probably need to fix an order $\{x_1,x_2,\ldots,x_n\}$ in order to express the terms of the product. Having chosen such an order, you might write:

$$f(X) = \prod_{x_i \in X} {\sum_{i\leq j\leq n} x_j\choose x_i} $$

which is somewhat loose, but conveys the behavior of the function.