Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

closed as off-topic by Kuba, rasher, m_goldberg, bobthechemist, Yves Klett Jun 26 at 5:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba, rasher, m_goldberg, bobthechemist, Yves Klett
If this question can be reworded to fit the rules in the help center, please edit the question.

4  
Could you provide minimal example? –  Kuba Jun 25 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 at 2:03
    
@Mr.Wizard I agree it seems familiar. This is the closest I've found: 5056 –  Michael E2 Jun 26 at 4:24

2 Answers 2

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 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.