Table
Details
- You can use Table to build up vectors, matrices, tensors, and other arrays.
- Table uses the standard Wolfram Language iteration specification.
- Table evaluates its arguments in a nonstandard way.
- Table[expr,spec] first evaluates spec, then localizes the variable specified and successively assigns values to it, each time evaluating expr.
- Table effectively uses Block to localize values or variables.
- Table[expr,spec1,spec2] is effectively equivalent to Table[Table[expr,spec2],spec1].
- Parallelize[Table[expr,iter]] or ParallelTable[expr,iter] computes Table[expr,iter] in parallel on all subkernels. »
Examples
open all close allBasic Examples (6)
A table of the first 10 squares:
Table[i ^ 2, {i, 10}]A table with
running from 0 to 20 in steps of 2:
Table[f[i], {i, 0, 20, 2}]Table[x, 10]Table[10i + j, {i, 4}, {j, 3}]MatrixForm[%]ListPlot[Table[Prime[i], {i, 50}]]Column[Table[Prime[i], {i, 5}]]Scope (6)
The index in the table can run backward:
Table[f[i], {i, 10, -5, -2}]Table[10i + j, {i, 5}, {j, i}]TableForm[%]Make a 3×2×4 array, or tensor:
Table[100i + 10j + k, {i, 3}, {j, 2}, {k, 4}]Iterate over an existing list:
Table[Sqrt[x], {x, {1, 4, 9, 16}}]Make an array from existing lists:
Table[j ^ (1 / i), {i, {1, 2, 4}}, {j, {1, 4, 9}}]Table evaluates the expression separately each time:
Table[RandomInteger[10], 20]Generalizations & Extensions (3)
The table index can have symbolic values:
Table[2 ^ x + x, {x, a, a + 5n, n}]The variables need not just be symbols:
Table[a[x]!, {a[x], 6}]Table[x[1] ^ 2 + x[2] ^ 2, {x[1], 3}, {x[2], 3}]ParallelTable computes Table in parallel:
ParallelTable[PrimeQ[2 ^ i - 1], {i, 10}]Table can be parallelized automatically, effectively using ParallelTable:
Parallelize[Table[PrimeQ[2 ^ i - 1], {i, 10}]]Applications (4)
Table[Plot[BesselJ[n, x], {x, 0, 10}], {n, 4}]Generate the corners of a polygon:
Graphics[Polygon[Table[{Sin[2 n Pi / 5], Cos[2 n Pi / 5]}, {n, 0, 5}]]]Column[Table[Binomial[i, j], {i, 0, 8}, {j, 0, i}], Center]Compare font sizes from 10 points to 20 points:
Table[Style["text", s], {s, 10, 20}]Properties & Relations (13)
Display of Tables (5)
Use ListPlot, ListLinePlot and similar functions to visualize numeric tables:
ListLinePlot[Table[DigitCount[n, 2, 1], {n, 128}]]Use Grid to format a two-dimensional table:
Grid[Table[{i, Prime[i]}, {i, 10}]]Two-dimensional numeric tables can be visualized with ArrayPlot and MatrixPlot:
ArrayPlot[Table[GCD[i, j], {i, 10}, {j, 10}]]Print the values of the table index while the table is being generated:
Table[Print[i];i ^ i ^ i, {i, 3}]Monitor the values by showing them in a temporary cell:
Monitor[Table[Pause[1];i ^ i ^ i, {i, 3}], i]Relations to Other Functions (5)
Range gives the sequence of values of a table iterator:
Range[1, 10, 2]Table[i, {i, 1, 10, 2}]Do evaluates the same sequence of expressions as Table, but does not return them:
Do[Print[i ^ i], {i, 3}]Table[i ^ i, {i, 3}]Sum effectively applies Plus to results from Table:
Sum[x ^ i, {i, 3}]Table[x ^ i, {i, 3}]Array iterates over successive integers:
Array[#1 ^ #2&, {3, 4}]Array[Function[{x, y}, x ^ y], {3, 4}]Table[x ^ y, {x, 3}, {y, 4}]Map applies a function to successive elements in a list:
list = RandomInteger[9, 10]Map[Last[IntegerDigits[#, 2]]&, list]Table can substitute successive elements in a list into an expression:
Table[Last[IntegerDigits[x, 2]], {x, list}]Nested Tables (1)
Using multiple iteration specifications is equivalent to nesting Table functions:
Table[i + j, {i, 3}, {j, i}]Table[Table[i + j, {j, i}], {i, 3}]Programmatic Table Construction (2)
Feed in parameters for tables:
Table[i - j, {i, #1}, {j, #2}]&@@{4, 5}Table[i - j, ##]&@@{{i, 4}, {j, 5}}Use Apply to splice a complete iterator specification into Table:
Table[{i[j], j + 1}, {j, 3}]Apply[Table[x, ##]&, %]With can insert the specification for a single iterator:
With[{s = {i, 5}}, Table[i ^ 2, s]]Possible Issues (6)
For some step sizes, output from Table may not include the upper limit given:
Table[x, {x, 0, 10, 3}]Table requires list iterator specifications to be given explicitly:
p = {x, 5};
Table[x ^ 2, p]Forcing early evaluation of the list resolves the issue:
Table[x ^ 2, Evaluate[p]]Alternatively, using With to lexically replace p with its list form:
With[{p = {x, 5}}, Table[x ^ 2, p]]Table normally reevaluates at each step:
Table[RandomReal[], {5}]Table[Evaluate[RandomReal[]], {5}]The Evaluate is needed to force evaluation of the table before it is fed to Plot:
Plot[Evaluate[Table[BesselJ[n, x], {n, 5}]], {x, 0, 15}]Plot[Table[BesselJ[n, x], {n, 5}], {x, 0, 15}]Values of Table variables do not get substituted inside held expressions:
Table[Hold[i], {i, 5}]Use With to insert values:
Table[With[{i = i}, Hold[i]], {i, 5}]Formatting wrappers such as Grid give expressions that are no longer lists:
Grid[Table[i j, {i, 4}, {j, 4}]]x + %InputForm[%]See Also
Range DiagonalMatrix IdentityMatrix Array Do Sum Product NestList NestWhileList SparseArray RecurrenceTable BooleanTable DiscretePlot ParallelTable ConstantArray StringRepeat FindRepeat
Function Repository: TableWhile FlatTable
Related Guides
Related Workflows
- Create a Matrix
History
Introduced in 1988 (1.0) | Updated in 2015 (10.2)
Text
Wolfram Research (1988), Table, Wolfram Language function, https://reference.wolfram.com/language/ref/Table.html (updated 2015).
CMS
Wolfram Language. 1988. "Table." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/Table.html.
APA
Wolfram Language. (1988). Table. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Table.html
BibTeX
@misc{reference.wolfram_2026_table, author="Wolfram Research", title="{Table}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/Table.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_table, organization={Wolfram Research}, title={Table}, year={2015}, url={https://reference.wolfram.com/language/ref/Table.html}, note=[Accessed: 12-June-2026]}