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?
2 Answers
$\begingroup$
$\endgroup$
1
One liner:
Table[expr,Evaluate[Sequence@@({#,lim}&/@Array[Subscript[p, #] &, n])]]
$\begingroup$
$\endgroup$
p0 = Array[Subscript[p, #] &, 7]
l0 = Table[1 + Mod[i, 3], {i, 7}]
Table[q, Evaluate[Sequence @@ Transpose[{p0, l0}]]]
Sum
rather thanTable
. $\endgroup$