scalar - Maple Help

The scalar Indexing Function

Description

 • The scalar indexing function can be used to construct rtable objects of type Array, Matrix, or Vector.
 • In the construction of a Matrix, the scalar[x] indexing function specifies a Matrix whose entries have the value x on the main diagonal and the value 0 everywhere else.
 The specification is the same in the construction of an Array.
 • In the construction of a Vector, the scalar[j, x] indexing function specifies a Vector which has the value x for entry j and the value 0 everywhere else.
 • Under normal circumstances, Maple only stores the value of x. To override this, specify a storage value.

Examples

 > $V≔\mathrm{Vector}\left(5,\mathrm{shape}=\mathrm{scalar}\left[2,3\right]\right)$
 ${V}{≔}\left[\begin{array}{c}{0}\\ {3}\\ {0}\\ {0}\\ {0}\end{array}\right]$ (1)
 > $M≔\mathrm{Matrix}\left(1..4,1..4,\mathrm{shape}=\mathrm{scalar}\left[3\right]\right)$
 ${M}{≔}\left[\begin{array}{cccc}{3}& {0}& {0}& {0}\\ {0}& {3}& {0}& {0}\\ {0}& {0}& {3}& {0}\\ {0}& {0}& {0}& {3}\end{array}\right]$ (2)