 LinearAlgebra - Maple Programming Help

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

LinearAlgebra

 DiagonalMatrix
 construct a (block) diagonal Matrix

 Calling Sequence DiagonalMatrix(V, r, c, options)

Parameters

 V - Vector or list; the diagonal entries r - (optional) non-negative integer; row dimension of resulting Matrix c - (optional) non-negative integer; column dimension of resulting Matrix options - (optional); constructor options for the result object

Description

 • The DiagonalMatrix(V) command constructs a (block) diagonal Matrix whose diagonal entries, starting from the upper left corner, are the elements of V.
 • If V is a Vector or a list of scalar values, then the blocks are 1 x 1 and DiagonalMatrix(V) constructs a diagonal Matrix.
 • If V is a list [B1, B2, ..., Bn] containing any non-scalar value, then the blocks are not necessarily 1 x 1 and DiagonalMatrix(V) builds a Matrix by placing each element, Bj, of V as an expanded block of entries, with each block placed immediately below and to the right of its predecessor. If the elements of V are all square (scalar values or square Matrices), a diagonal or block diagonal Matrix in the usual sense is returned.
 • Either the column dimension, or both the row and column dimension of the resulting Matrix may be included in the calling sequence. If these optional parameters are omitted, the size of the constructed Matrix is determined from the natural corresponding dimension of V.
 • The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix 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).
 The default shape of the resulting Matrix can be overridden by including a mutable shape in options.
 • By using this function in conjunction with the JordanBlockMatrix function, you can easily create a Jordan Form Matrix.
 • This function is part of the LinearAlgebra package, and so it can be used in the form DiagonalMatrix(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[DiagonalMatrix](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $L≔\left[⟨1,2⟩,3,⟨⟨4,5⟩|⟨6,7⟩⟩\right]$
 ${L}{≔}\left[\left[\begin{array}{c}{1}\\ {2}\end{array}\right]{,}{3}{,}\left[\begin{array}{cc}{4}& {6}\\ {5}& {7}\end{array}\right]\right]$ (1)
 > $\mathrm{DiagonalMatrix}\left(L\right)$
 $\left[\begin{array}{cccc}{1}& {0}& {0}& {0}\\ {2}& {0}& {0}& {0}\\ {0}& {3}& {0}& {0}\\ {0}& {0}& {4}& {6}\\ {0}& {0}& {5}& {7}\end{array}\right]$ (2)
 > $V≔⟨1,2,3,4⟩$
 ${V}{≔}\left[\begin{array}{c}{1}\\ {2}\\ {3}\\ {4}\end{array}\right]$ (3)
 > $\mathrm{DiagonalMatrix}\left(V,5,6\right)$
 $\left[\begin{array}{cccccc}{1}& {0}& {0}& {0}& {0}& {0}\\ {0}& {2}& {0}& {0}& {0}& {0}\\ {0}& {0}& {3}& {0}& {0}& {0}\\ {0}& {0}& {0}& {4}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}& {0}\end{array}\right]$ (4)