2

I want to list {a,c} but c is depend on b, suppose the dependence on b can not written as a simple function c(b). How can I create a list of {a,c} list without list out b in the intermediate.

My workaround is this:

list = Table[{a, b = a^2, c = b^2}, {a, 0, 10, 1}];
listWanted = list[[All, {1, 3}]]

However suppose the intermediate variable is many, doing this is cumbersome, at least not neat. I just want to calculate these intermediate value but not list them.

an offer can't refuse
  • 1,745
  • 12
  • 23

1 Answers1

2

One can using the ; operator to do the evaluation, but suppress the output. So the code can be the following as pointed out in the comment:

Table[{a, b = a^2; c = b^2}, {a, 0, 10, 1}]
an offer can't refuse
  • 1,745
  • 12
  • 23