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 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:
Use
Outer to apply a function to elements of multiple lists:
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:
Data from a function sampled at points in two dimensions:
A piecewise polynomial that interpolates the data: