array - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Libraries and Packages : Deprecated Packages and Commands : Deprecated commands : array(deprecated)

array

create an array

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Calling Sequence

array( indexfcn, bounds, list)

array( a)

Parameters

indexfcn

-

(optional) indexing function

bounds

-

(optional) sequence of ranges

list

-

(optional) list of initial values

a

-

(optional) array

Description

• 

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.

Thread Safety

• 

The array command is thread-safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

Examples

Important: The array command has been deprecated. Use the superseding command Array instead.

varray1..4:

forito3dovii2end do:printv

149`?`4

(1)

v2

4

(2)

Trying to refer to something out of bounds returns an error:

v0

Error, 1st index, 0, smaller than lower array bound 1

Aarray1..2,1..2:

A1,2x:

A1,1

A1,1

(3)

A1,2

x

(4)

printA

`?`1,1x`?`2,1`?`2,2

(5)

Aarraysymmetric,1..2,1..2,1,x,x,x2:

op1,evalA

symmetric

(6)

op2,evalA

1..2,1..2

(7)

op3,evalA

2,2=x2,1,2=x,1,1=1

(8)

mapdiff,A,x

0112x

(9)

See Also

Array

entries

indices

linalg(deprecated)

linalg(deprecated)[matrix]

map

Matrix

print

table

type/array

Vector

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam