LinearAlgebra - Maple Programming Help

Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Constructors : LinearAlgebra/UnitVector

LinearAlgebra

 UnitVector
 construct a unit Vector

 Calling Sequence UnitVector[o](i, d, cpt, options)

Parameters

 i - positive integer; index of the non-zero entry d - positive integer; dimension of the resulting Vector cpt - (optional) BooleanOpt(compact); selects the compact form of the output options - (optional); constructor options for the result object [o] - (optional) use either [row] or [column] to specify the orientation of the resulting Vector

Description

 • The UnitVector(i, d) function returns a d-dimensional Vector in which the ith entry is one and all other entries are zero.
 • The UnitVector[row](i, d) function acts like UnitVector(i, d) except that a row Vector is returned.  If the orientation option is omitted or if UnitVector[column](i, d) is used, a column Vector is returned.
 • If the compact option (cpt) is omitted, or, if it is included in the calling sequence as just the symbol compact or in the form compact=true, then the result is built by using a shape function designed to minimize storage. If the option is entered as compact=false, a full rectangular object is constructed.
 • The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Vector constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 • This function is part of the LinearAlgebra package, and so it can be used in the form UnitVector(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[UnitVector](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $\mathrm{v1}≔\mathrm{UnitVector}\left(4,5\right)$
 ${\mathrm{v1}}{:=}\left[\begin{array}{r}{0}\\ {0}\\ {0}\\ {1}\\ {0}\end{array}\right]$ (1)
 > $\mathrm{VectorOptions}\left(\mathrm{v1},\mathrm{shape}\right)$
 $\left[{{\mathrm{unit}}}_{{4}}\right]$ (2)
 > $\mathrm{v2}≔\mathrm{UnitVector}[\mathrm{row}]\left(1,3,\mathrm{compact}=\mathrm{false}\right)$
 ${\mathrm{v2}}{:=}\left[\begin{array}{ccc}{1}& {0}& {0}\end{array}\right]$ (3)
 > $\mathrm{VectorOptions}\left(\mathrm{v2},\mathrm{shape}\right)$
 $\left[{}\right]$ (4)