1 | initial version |
The diagonal matrix is an easy one:
sage: diagonal_matrix(range(-2,3))
[-2 0 0 0 0]
[ 0 -1 0 0 0]
[ 0 0 0 0 0]
[ 0 0 0 1 0]
[ 0 0 0 0 2]
The upper and lower diagonals are trickier. The best I could come up with is:
sage: block_matrix([[ 0, identity_matrix(4) ], [ zero_matrix(1,1), 0 ]])
[0|1 0 0 0]
[0|0 1 0 0]
[0|0 0 1 0]
[0|0 0 0 1]
[-+-------]
[0|0 0 0 0]
sage: block_matrix([[ 0, zero_matrix(1,1) ], [ identity_matrix(4), 0 ]])
[0 0 0 0|0]
[-------+-]
[1 0 0 0|0]
[0 1 0 0|0]
[0 0 1 0|0]
[0 0 0 1|0]