create an array
array( indexfcn, bounds, list)
(optional) indexing function
(optional) sequence of ranges
(optional) list of initial values
Important: The array command has been deprecated. Use the superseding command Array instead.
An array is a specialization of a table, with zero or more specified dimensions, where each dimension is an integer range. The result of executing the array function is to create an array. For example, V := array(1..10) creates a one dimensional array of length 10 but with no explicit entries. The command A := array(1..m, 1..n) (where m and n evaluate to positive integers) creates a two dimensional array with m rows and n columns.
All parameters to the array function are optional and may appear in any order, but at least one bound and list must appear. The bounds parameter is a sequence of integer ranges which must appear consecutively. If the bounds are not specified then they are deduced from the list of initial values.
The indexfcn can be a procedure or a name specifying how indexing is to be performed - see indexfcn for more information. The built-in indexing functions are symmetric, antisymmetric, sparse, diagonal, and identity. If indexfcn is not specified, then ``ordinary'' indexing is used.
The list of initial values may be a list of equations (cf. tables), or a list of values (one-dimensional), or a nested list of lists (row-by-row).
The map function can be used to apply a function to each entry of an array. For example, map (simplify, A) simplifies each entry of the array A.
Arrays have special evaluation rules (like procedures) so that if the name A has been assigned an array then A evaluates to the name A and eval(A) yields the actual array structure.
The op function extracts the operands of an array structure. op(1, eval(A)) yields indexfcn, if one is specified. If no indexfcn has been specified, it returns nothing. op(2, eval(A)) yields bounds; and op(3, eval(A)) yields entries, where entries is a list of equations corresponding to the explicit entries in the array (cf. entries).
When the array constructor is called with a single argument, a, whose value is an existing array, a copy of a is returned. Since arrays are mutable objects, and assignment in Maple is by-reference, making a copy of an array to work with is useful when you do not want to modify the original array.
The array command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
v ≔ array⁡1..4:
forito3dovi ≔ i2end do:print⁡v
Trying to refer to something out of bounds returns an error:
Error, 1st index, 0, smaller than lower array bound 1
A ≔ array⁡1..2,1..2:
A1,2 ≔ x:
A ≔ array⁡symmetric,1..2,1..2,1,x,x,x2:
Download Help Document