Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Matrices and Linear Algebra > Constructing Matrices >

Array

Array[f, n]
generates a list of length n, with elements f[i].
Array[f, {n1, n2, ...}]
generates an n_1xn_2x... array of nested lists, with elements f[i1, i2, ...].
Array[f, {n1, n2, ...}, {r1, r2, ...}]
generates a list using the index origins ri (default 1).
Array[f, dims, origin, h]
uses head h, rather than List, for each level of the array.
Generate a 3x2 array:
Generate a 3x4 array:
Use index origin 0 instead of 1:
Start with indices 0 and 4 instead of 1:
Use ## to pick up a sequence of indices:
Use Plus instead of List to combine elements:
3x3 matrix of 0s:
Totally antisymmetric tensor:
Lower-triangular matrix:
Matrix with generic symbolic entries:
Use it to see the effects of some linear algebra functions:
ConstantArray[c, dims] and Array[c&, dims] are equivalent:
When c is a machine number, ConstantArray is much faster for large arrays:
Array[f, dims] can be generated using Table:
Set up the Table limit specifications:
Use Apply to splice them into a Table command:
The result is identical to the array generated using Array:
SparseArray[{i_, j_}->f[i, j], dims] gives a sparse representation of Array[f, dims]:
The results are Equal:
The objects are not identical, but the represented arrays are:
Array of powers:
Array of GCDs:
Array of arrays:
New in 1 | Last modified in 4
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team