Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Lists and Matrices / List Construction  /
Table

  • Table[ expr , imax ] generates a list of imax copies of expr.
  • Table[ expr , i , imax ] generates a list of the values of expr when i runs from 1 to imax.
  • Table[ expr , i , imin , imax ] starts with i = imin.
  • Table[ expr , i , imin , imax , di ] uses steps di.
  • Table[ expr , i , imin , imax , j , jmin , jmax , ... ] gives a nested list. The list associated with i is outermost.
  • Table evaluates its arguments in a non-standard way (see Section A.4.2).
  • Example: Table[f[i], i, 4 ].
  • Table uses the standard Mathematica iteration specification.
  • Example: Table[i-j, i, 2 , j, 2 ].
  • You can use Table to build up vectors, matrices and tensors.
  • See the Mathematica book: Section 1.7.3Section 1.8.2.
  • See also: Range, DiagonalMatrix, IdentityMatrix, Array, Do, Sum, Product, FunctionInterpolation.
  • Related package: LinearAlgebra`MatrixManipulation`.

    Further Examples

    Here are the squares of the first 10 integers.

    In[1]:=

    Out[1]=

    This gives the cubes of the integers from -3 to 3.

    In[2]:=

    Out[2]=

    Here is Pascal's triangle using nested lists with the inner iterator j dependent upon the outer iterator i. The output is then formatted with TableForm.

    In[3]:=

    Out[3]//TableForm=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.