construct a Vector
Vector(n, init, ro, sym, sh, st, dt, f, a, o)
Vector[column](n, init, ro, sym, sh, st, dt, f, a, o)
Vector[row](n, init, ro, sym, sh, st, dt, f, a, o)
(optional) non-negative integer or integer range starting at 1; number of elements in the Vector
(optional) Maple procedure, table, Array, Vector, set of equations, list, or expression of type algebraic; initial values for the Vector
(optional) equation of the form readonly=true or false; specify whether Vector entries can be changed
(optional) equation of the form symbol=name; specifies the symbolic name to be used for the Vector entries
(optional) equation of the form shape=name or shape=list specifying one or more built-in or user-defined indexing functions; storage allocation for Vector entries
(optional) equation of the form storage=name, where name is a permitted storage mode; storage requirements for Vector entries
(optional) equation of the form datatype=name, where name is any Maple type, float, float, double, complex, or integer[n] for n=1,2,4, or 8; type of data stored in Vector
(optional) equation of the form fill=value, where value is of the type specified by the dt parameter; specifies Vector entries at locations not otherwise set
(optional) equation of the form attributes=list, where list contains permitted attributes; specifies additional mathematical properties of the Vector
(optional) equation of the form orientation=name, where name is either row or column; specifies Vector orientation
The Vector(..) function (vector) is the constructor for the Vector data structure. It is one of the principal data structures on which the LinearAlgebra routines operate. The specialized Maple packages for computing with vectors are VectorCalculus and Physics/Vectors.
In Vector(..), all parameters are optional. However, enough information must be provided in the calling sequence for the mathematical shape of the Vector and the storage requirements for its entries to be determined. In particular, if no parameters are specified, the result is a size 0 Vector (that is, an element of a zero-dimensional vector space).
The Vector(n) function constructs an n-element column Vector whose entries are determined by the fill value in parameter f (default = 0). If the number of elements is not provided, it defaults to 0. If the orientation option is omitted, a column Vector is returned.
The Vector(init) function constructs a Vector whose shape and entries are determined by parameter init.
The Vector(n, init) function constructs an n-element column Vector whose initial entries are determined by parameter init (and parameter f if all of the entries in the Vector are not set by init).
Parameter init can take any one of the following forms. (The number of elements, n, must be provided in the calling sequence if init is an expression, table, or set.)
The procedure must accept a positive integer as an argument (that is, Vector index) and return the value for the corresponding entry in the Vector.
expression of type algebraic
The expression is evaluated as a function (or procedure) which takes a positive integer as an argument (that is, Vector index) and returns the value of the corresponding entry of the Vector.
The table is referenced by index of the form [j] where j is a positive integer (that is, Vector index). (The table may include entries for indices of other forms. These will be ignored.)
set of equations
The set of equations must take the form j = <value> where j is a positive integer (that is, Vector index). It is an error to specify entries for locations that are outside the index range of the resulting Vector.
The Array must be a one-dimensional. The indexing in the Array is shifted to be 1-based. It is an error to specify entries for locations that are outside the index range of the resulting Vector.
The Vector constructor accepts another Vector as an initializer for the entries. It is an error to specify entries for locations that are outside the index range of the resulting Vector. Therefore, the size of the initializing Vector must be less than or equal to the size of the resulting Vector.
If init is a list, then it is first scanned to see if any of its entries are themselves lists. Any such sublists are unwrapped, replacing the sublists with the expression sequence of their entries. This operation is not recursive (the unwrapping is carried out only one level). Once this unwrapping is completed, the elements of the (possibly modified) list are placed, in order, in the corresponding locations of the Vector under construction. It is an error to specify entries for locations that are outside the index range of the resulting Vector. It is an error for the list to be two dimensional (for example, contain both a row Vector and column Vector, or contain a Matrix with row and column dimensions > 1, or 2-D Array).
If the ro option is included in the calling sequence as either readonly or readonly=true, then the resulting Vector is "readonly" (that is, its entries cannot be changed after construction).
The sym option, in the form symbol=name, provides a symbolic name to use for the Vector entries if no initializer is provided. This parameter is ignored if an initializer is given.
Parameters may be included more than once. If more than one integer is included in the calling sequence, the first is n and the second is init (algebraic expression case). Otherwise, if a parameter is repeated, the last occurrence is the effective one.
Parameters may be given in any order (except that the interpretation of integer parameters is always that the first is n).
The remaining parameters in the calling sequence have been provided for achieving maximal efficiency in computations with Vectors.
shape=name or shape=list
Specifies one or more built-in or user-defined indexing functions that determine the nonzero structure of the Vector. If more than one indexing function is included, they must be entered as a list. The default shape is  (none). For Vectors, the built-in indexing functions are:
For more information, see storage and rtable_indexfcn.
Specifies how physical memory is allocated for storing the entries of the Vector. The default storage is rectangular.
For more information, see storage.
Specifies the type of data stored in the Vector. It can be one of integer[n], float[n], double, complex[n], or any Maple type specification.
For integer[n], n can be 1, 2, 4, or 8, indicating the number of bytes per integer. For float[n] , n can be 4 or 8, again indicating the number of bytes per floating-point number. The double datatype is the same as the float datatype. For complex[n], the only allowable value of n is 8, indicating the number of bytes allocated for each of the real and imaginary parts of the values stored in the Vector. The default datatype is the general Maple type anything.
Specifies the value for unspecified Vector elements. This value must meet the same evaluation requirements as the initializer values. The default fill value is 0.
Note: The fill value is only used to fill those elements of the Vector that are unspecified in spite of the indexing function. In the case of a sparse Vector, the fill value is always ignored.
Specifies the attributes with which the Vector is created. This option can be used to attach mathematical properties to the Vector. Anything that is a valid argument to setattribute can be an attribute of a Vector.
The default is to have no attributes.
Specifies whether the resulting object is a row Vector or column Vector. If the orientation is specified both as an index (for example, Vector[row]) and by this parameter in the calling sequence, the index orientation takes precedence. For example, if the calling sequence is specified as Vector[row](.., orientation=column, ...), then the resulting object is a row Vector.
After creation, it is possible to change the entries and some of the mathematical properties of the Vector. See Vector assignment and Vector options for more information.
For additional information on accessing elements or groups of elements of a Vector, see Vector indexing.
If expr is a Vector[row] or Vector[column] expression, the nops(expr) function returns 3.
If expr is a Vector[row] or Vector[column] expression, the op(o, expr) function returns the following operands for the specified values of o.
Vector[row] or Vector[column]
Vector size as an integer
Vector elements as a set of equations of the form (indices)=value *
Vector options as an expression sequence of equations of the form option=value **
* Only the elements that explicitly need to be specified, taking into account storage, are returned.
** The subtype option is not returned since it is implicitly Vector[row] or Vector[column]. The user and built-in indexing functions are returned as options.
Only small Vectors are displayed inline in Maple. By default, a small Vector is defined as one whose size is in the range 1..25 (TTY version of Maple) or the range 1..10 (GUI version of Maple). Any Vector larger than this size is displayed by using a placeholder. For information on how to view a placeholder, see structuredview.
You can display larger Vectors inline by using the interface(rtablesize=value) command, where value is an integer that represents the upper bound of the size range.
To change the environment so that Maple always displays rtables inline, include the interface(rtablesize=infinity) command in a Maple initialization file (see maple).
For more information, see interface.
Vectors do not have last name evaluation.
A two-element Vector.
A column Vector with all entries set to 5.
Note that when orientation of a Vector is not provided, a column Vector is returned.
A row Vector with entries given as list.
You can use functions to initialize values for corresponding entries in a Vector.
f ≔ j→xj−1:
Or, use set notation to specify entries at each location.
s ≔ 1=0,2=1:
Create a Vector using symbolic name for the entries.
Use the built-in index function unit to construct a unit Vector.
In the following example, S returns the addition of two column Vectors. The option fill specifies entries for the first Vector, and a list is used to specify entries of the second Vector.
S ≔ Vector⁡3,fill=2+Vector⁡3,1,2,3
To evaluate the data type of S:
It is an error to attempt to write to a read-only Vector.
A ≔ Vector⁡1,2,3,readonly=true
A1 ≔ Vector⁡2
Error, cannot assign to a read-only Vector
The datatype option was updated in Maple 2015.
Download Help Document
What kind of issue would you like to report? (Optional)