unit - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

The unit Indexing Function

Description

 • The unit indexing function can be used to construct 1-dimensional rtable objects of type Array or Vector.
 • In the construction of a Vector, the unit[j] indexing function specifies a Vector which has the value 1 for entry j and the value 0 everywhere else.
 The specification in the construction of a 1-dimensional Array is similar.
 • If an object is defined by using the unit indexing function, its elements cannot be reassigned.
 • Under normal circumstances, no storage is allocated for the entries of an object constructed by using the unit indexing function.

Examples

 > $A≔\mathrm{Array}\left(\mathrm{unit}\left[2\right],1..3\right)$
 ${A}{≔}\left[\begin{array}{ccc}{0}& {1}& {0}\end{array}\right]$ (1)
 > $V≔\mathrm{Vector}\left(4,\mathrm{shape}=\mathrm{unit}\left[3\right]\right)$
 ${V}{≔}\left[\begin{array}{c}{0}\\ {0}\\ {1}\\ {0}\end{array}\right]$ (2)
 > $V\left[2\right]≔3$

 See Also