linalg(deprecated)/diag - Maple Help

linalg(deprecated)

 diag
 create a block diagonal matrix
 BlockDiagonal
 a synonym for diag

 Calling Sequence diag(B1, B2, .., Bn) BlockDiagonal(B1, B2, ..., Bn)

Parameters

 B[1], B[2], ..., B[n] - square matrices or scalar matrix entries

Description

 • Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[DiagonalMatrix], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The call diag(B1, B2, .., Bn) returns a matrix on whose diagonal are the matrix blocks B1, B2, .., Bn.
 • If used in conjunction with JordanBlock, diag can be used to easily create a Jordan form matrix.
 • The command with(linalg,diag) allows the use of the abbreviated form of this command.

Examples

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[DiagonalMatrix], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $\mathrm{B1}≔\mathrm{array}\left(\left[\left[1,3,5\right],\left[9,a,z\right],\left[{x}^{2},\mathrm{sin}\left(q\right),10\right]\right]\right)$
 ${\mathrm{B1}}{≔}\left[\begin{array}{ccc}{1}& {3}& {5}\\ {9}& {a}& {z}\\ {{x}}^{{2}}& {\mathrm{sin}}{}\left({q}\right)& {10}\end{array}\right]$ (1)
 > $\mathrm{B2}≔\mathrm{matrix}\left(2,2,\left[1,3,2,4\right]\right)$
 ${\mathrm{B2}}{≔}\left[\begin{array}{cc}{1}& {3}\\ {2}& {4}\end{array}\right]$ (2)
 > $\mathrm{diag}\left(\mathrm{B1},\mathrm{B2}\right)$
 $\left[\begin{array}{ccccc}{1}& {3}& {5}& {0}& {0}\\ {9}& {a}& {z}& {0}& {0}\\ {{x}}^{{2}}& {\mathrm{sin}}{}\left({q}\right)& {10}& {0}& {0}\\ {0}& {0}& {0}& {1}& {3}\\ {0}& {0}& {0}& {2}& {4}\end{array}\right]$ (3)
 > $\mathrm{diag}\left(\mathrm{λ1},\mathrm{λ2}\right)$
 $\left[\begin{array}{cc}{\mathrm{λ1}}& {0}\\ {0}& {\mathrm{λ2}}\end{array}\right]$ (4)