Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Let $P=\{p_1,...p_n\}$. I would like a way to implent Table[Expression,{$p_1$,lim},{$p_2$,lim},...,{$p_n$,lim}] where n and lim are parameters defined by the user. Any ideas?

share|improve this question

marked as duplicate by Mr.Wizard Jun 27 '15 at 9:56

This question was marked as an exact duplicate of an existing question.

Could you provide minimal example? – Kuba Jun 25 '14 at 19:51
This seems very familiar, assuming my interpretation is correct, but I can't find the original. Help, anyone? – Mr.Wizard Jun 26 '14 at 2:03
@Mr.Wizard I agree it seems familiar. This is the closest I've found: 5056 – Michael E2 Jun 26 '14 at 4:24
This question was closed and due for deletion. I feel that it could be useful as a redirect so I am marking it as a duplicate instead, even though the "original" is about Sum rather than Table. – Mr.Wizard Jun 27 '15 at 9:55
up vote 0 down vote accepted

One liner:

Table[expr,Evaluate[Sequence@@({#,lim}&/@Array[Subscript[p, #] &, n])]]
share|improve this answer
Exactly what I needed! Thanks! – Heterotic Jun 26 '14 at 8:37
p0 = Array[Subscript[p, #] &, 7]  
l0 = Table[1 + Mod[i, 3], {i, 7}]  
Table[q, Evaluate[Sequence @@ Transpose[{p0, l0}]]]
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.