# Mathematical notation corresponding to a Mathematica function

Apologies if this is not the right forum, I am happy to re-post somewhere more appropriate. I would like to know the mathematical notation for the following Mathematica expression:

 Apply[Plus,
Times @@@
Subsets[Table[Subscript[\[Delta], i], {i, 1, J}], {J - j} ] ]


where J and j are positive integers, such that $$J \ge j > 0$$, and $$\delta_i$$ ($$i=1,\ldots,J$$) are positive constants. Unsurprisingly, the Mathematica "Copy as LaTex" functionality does not work for this type of code. Any suggestions would be greatly appreciated.

• This is not a well-posed question. This is a piece of code describing an algorithm. It's not always productive to try to give mathematical notation for it. Can you clarify the question? Do you want to know what the code does? If you already know it, coming up with mathematical notation for it is off-topic here. If not, then break down the expression and ask about the specific part you don't understand and could not look up in the documentation. Jun 2, 2022 at 0:19
• The code takes all possible subsets of $\delta_i$, mutliplies the elements within each, and adds up the results. Note that the empty subset is considered as well, for which the product is 1. Jun 2, 2022 at 0:21
• I do now what the code does, I was simply looking for how to write this in proper mathematical notation. Please see the comment below by eyorble, which answers my question. Jun 2, 2022 at 2:18
• Hi OP, welcome to mma.SE! If the answer(not comment) does indeed answer your question, it would be useful to accept the answer by giving it a green checkmark! Jun 2, 2022 at 14:20
• Thanks CA Trevillian. Will do. Jun 3, 2022 at 4:22

The code provided appears to implement the following:

Let $$\Delta$$ be a set containing $$\delta_1, ..., \delta_i, ..., \delta_J$$. In the original code, this would refer to Table[Subscript[δ,i],{i,1,J}].

Let $$S = \binom{\Delta}{J-j}$$. This is the set of all distinct combinations of $$J-j$$ members of $$\Delta$$. This is based on this math.SE answer. In the original code, this would refer to Subsets[..., {J-j}].

The expression given is then: $$\sum_{U \in S} \prod_{v \in U} v$$. This is based on another math.SE answer. In the original code, this is the Apply[Plus,Times@@@ ...] part, though the translation into sums and products is perhaps not as clean as this might seem to make it.

A more direct implementation of this last step might look like:

Sum[Product[v, {v, u}], {u, Subsets[Table[Subscript[δ,i], {i, 1, J}], {J-j}]}]


Which is functionally identical but perhaps easier to reason about. For example, it should be relatively clear that Product[v, {v, u}] is equivalent to Times @@ u, and then instead of summing over the subsets all of the subsets can have Times applied at once with @@@ and Apply[Plus,...] can be used in place of Sum.

• Thanks @eyorble - this is exactly what I was looking for. Jun 2, 2022 at 2:16