DOM_ARRAY

(symbolic, multidimensional) arrays

Description

DOM_ARRAY is a multidimensional container type, storing arbitrary MuPAD® objects at integer indices.

Arrays are a fundamental data type in many programming languages: For a fixed number of indices ("dimensions"), for each index an integer from a fixed range, an array provides space to store an arbitrary piece of data at this combination.

Function Calls

Using an array as a function symbol creates the list obtained by using each array entry as a function symbol for the operands used, i.e., array(1..2, [f, g])(x, y) results in array(1..2, [f(x, y), g(x, y)]).

Operations

As with any container, the most important operation on an array is reading and writing its entries, which is performed by indexed access, as in A[1, 2] or B[1, 3, 2] := exp(x). Trying to access an element outside the boundaries of an array raises an error.

The function map applies some function or transformation to each element of an array, returning an array of the same format as its input, with the results of the calls as its entries.

If A is an array, nops(A) returns the number of elements in A.

Operands

If A is an array, the 0th operand of A, op(A, 0), will be the sequence starting with the number of dimensions (an integer n) followed by n ranges of integers, which denote the acceptable ranges of indices for each dimension, including both numbers listed in the range.

For 1 ≤ inops(A), the ith operand of A is the ith entry of A, in the lexicographic order of indices.

Uninitialized entries of arrays will be displayed symbolically while still in the array. When being accessed by op or indexed access, NIL is returned.

Output

One-dimensional arrays are displayed as row vectors, two-dimensional arrays as matrices. Higher-dimensional arrays are written in functional form, using the index = value notation, and do not have a typesetting version. This also causes typesetting to be disabled for any surrounding expression in the same output.

Element Creation

The primary way of creating arrays is the function array. Beside that, obviously, coerce can convert a number of data types, such as matrices into arrays and a number of MuPAD functions, especially in the numeric library, return arrays.

See Also

MuPAD Domains

MuPAD Functions

Was this topic helpful?