# Pass the range to a Table as a list

Potentially very silly question here.

What I have:

xaxis = {r, 0, 3}


And if I do:

Plot[r^2, xaxis]


it works.

I'd like to the same for a Table, i.e. defining its paratemers (range, step etc.) elsewhere and then just importing them, like so:

Table[r, Append[xaxis, 0.1]]


where the 0.1 there is the step I am taking.

This does not work however!
Is it not possible at all?
Do I have to define it like  Table[r, {r,0,3,0.1}] ?

• Table[r, Evaluate@Append[xaxis, 0.1]] – Bob Hanlon Jan 29 '18 at 16:48
• That solved it, thanks. Any physical reason as to why this works and method did not? – SuperCiocia Jan 29 '18 at 16:54
• Table has the attribute HoldAll – Bob Hanlon Jan 29 '18 at 16:56
• Thanks. Out of curiosity how do I know this? I couldn't find it mentioned on the documentation? – SuperCiocia Jan 29 '18 at 17:05
• Evaluate ?? Table – Bob Hanlon Jan 29 '18 at 17:06

I would try to work with the syntax:

Table[body, {iter, values}]


xaxis = Sequence[0, 3];
xiter = Range[xaxis];

(* Table *)

Table[x, {x, xiter}]
(* or *)
Table[x, {x, Range[xaxis]}]

(* Plot *)
Plot[x, {x, xaxis}]


{0, 1, 2, 3}

{0, 1, 2, 3}

xiter = Range[xaxis, .1];