3
$\begingroup$

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?

$\endgroup$
  • 4
    $\begingroup$ Could you provide minimal example? $\endgroup$ – Kuba Jun 25 '14 at 19:51
  • $\begingroup$ This seems very familiar, assuming my interpretation is correct, but I can't find the original. Help, anyone? $\endgroup$ – Mr.Wizard Jun 26 '14 at 2:03
  • $\begingroup$ @Mr.Wizard I agree it seems familiar. This is the closest I've found: 5056 $\endgroup$ – Michael E2 Jun 26 '14 at 4:24
  • 1
    $\begingroup$ 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. $\endgroup$ – Mr.Wizard Jun 27 '15 at 9:55
0
$\begingroup$

One liner:

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

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