0

This is possibly a dumb question: inside a function, I first define

Rho = Table[xrho[m], {m, 1, k}]

then populate it using

Do[xrho[d] = q1^i q2^j; d++, {i, 1, Length[p]}, {j, 1, Length[p[[i]]]}]

and then update its value such that I can call it later inside the function

RhoTrue = Table[xrho[m], {m, 1, k}]

This works but seems dumb: is there a way to directly define it in therms of the other two (or more) counting variables?

jj_p
  • 210
  • 1
  • 6

1 Answers1

1

Not entirely sue what you're trying to do, but would the single line

RhoTrue = Flatten[Table[q1^i q2^j, {i, 1, Length[p]}, {j, 1, Length[p[[i]]]}]]

not work for you?

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323