THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

# List ({...})

 {e1, e2, ...}is a list of elements.
• Lists are very general objects that represent collections of expressions.
• Functions with attribute Listable are automatically "threaded" over lists, so that they act separately on each list element. Most built-in mathematical functions are Listable.
• {a, b, c} represents a vector.
• {{a, b}, {c, d}} represents a matrix.
• Nested lists can be used to represent tensors.
 Scope   (26)
A vector is a list of nonlist elements:
Many operations work on vectors, like Dot and Norm:
A matrix is a list of vectors of equal length:
Many operations work with matrices, like Dot, Transpose and Det:
A rectangular array is represented by nested lists with consistent dimensions:
Many operations work on arrays of any depth, like Dot and Fourier:
The three-dimensional discrete Fourier transform:
Ragged arrays that are not rectangular can also be used:
Many structural functions will work with ragged arrays:
If the elements are at the same depth you can use PadRight to make a rectangular array:
Range constructs a list consisting of a range of values:
Array constructs lists using a function:
When given multiple dimensions, matrices or deeper arrays are constructed:
Table constructs lists using an expression and an iterator:
When given multiple iterators, matrices and arrays can be constructed:
Functional commands like NestList create lists of the results:
To construct a list when the length is not known ahead of time, Sow and Reap are efficient:
Some trials of rolling a die until the same number comes up twice in a row:
Scalar multiple:
Sine of a vector:
Scalar multiple of a matrix:
Matrix plus a vector adds the component of the vector to the rows of the matrix:
Function applied element-wise to a matrix:
Any function that has the Listable attribute will thread over lists element-wise:
Apply makes the elements of a list the arguments of a function:
If you have a nested list, applying at level 1 gives a list f applied to the sublists:
Map applies a function to the elements of a list:
For a nested list, Map can apply f at any level or multiple levels:
Do, Product, Sum, and Table can iterate over a list:
Part can be used to get elements of lists:
You can get multiple parts by specifying a list of parts:
Or by using Span:
Use Outer to apply a function to elements of multiple lists:
Complement, Union and Intersection treat List as a set:
Construct various combinatorial structures using Subsets, Tuples and IntegerPartitions:
Many commands use {var, vmin, vmax} as a specification of variable range:
Many commands use {v1, v2, ...} for a collection of variables:
A list of rules is returned as a solution by many solving commands:
You can use the values of the results with ReplaceAll:
When multiple solutions are possible, the result is a list of rule lists:
When a list of rule lists is used in ReplaceAll, you get a list of results:
Even if there is only one solution, the extra List is used for consistent structure:
Lists are very good for holding data since the elements can be anything:
Sine of successive squares:
Plot the data:
Data from a function sampled at points in two dimensions:
A piecewise polynomial that interpolates the data:
Plot the data directly:
A SparseArray represents a list:
They are Equal:
They can be equivalently used in many commands:
They are not identical because the representation is different:
Normal[slist] gives the List representation:
New in 1
 Site Index Choose Language