Maxima Function
diag (lm)
Constructs a square matrix with the matrices of lm in the diagonal. lm is a list of matrices or scalars.
Example:
(%i1) load("diag")$ (%i2) a1:matrix([1,2,3],[0,4,5],[0,0,6])$ (%i3) a2:matrix([1,1],[1,0])$ (%i4) diag([a1,x,a2]); [ 1 2 3 0 0 0 ] [ ] [ 0 4 5 0 0 0 ] [ ] [ 0 0 6 0 0 0 ] (%o4) [ ] [ 0 0 0 x 0 0 ] [ ] [ 0 0 0 0 1 1 ] [ ] [ 0 0 0 0 1 0 ]
To use this function write first load("diag")
.