Previous Up Next

6.44.2  Special matrices

Identity matrix: idn identity

The idn command finds identity matrices.


Examples.

Zero matrix: newMat

The newMat command creates a matrix of all 0s.


Example.
Input:

newMat(4,4)

Output:





0000
0000
0000
0000




Diagonals of matrices and diagonal matrices: BlockDiagonal diag

The diag command either creates a diagonal matrix or finds the diagonal elements of an existing matrix.
BlockDiagonal is a synonym for diag.


Examples.

Jordan block: JordanBlock

The JordanBlock command creates a Jordan Block; i.e., a square matrix with the same value for all diagonal elements, 1s just above the diagonal, and 0s everyone else.


Example.
Input:

JordanBlock(7,3)

Output:




710
071
007



Hilbert matrix: hilbert

A Hilbert matrix is a square matrix whose element in the ith row and jth column (recall the numbering starting at 0) is

aj,k=
1
j+k+1

The hilbert command finds Hilbert matrices.


Example.
Input:

hilbert(4)

Output:

















1
1
2
1
3
1
4
1
2
1
3
1
4
1
5
1
3
1
4
1
5
1
6
1
4
1
5
1
6
1
7
















Vandermonde matrix: vandermonde

A Vandermonde matrix is a square matrix where each row starts with a 1 and is in geometric progression. The vandermonde command finds a Vandermonde matrix.


Warning!
The indices of the rows and columns begin at 0 with Xcas.


Example.
Input:

vandermonde([a,2,3])

Output (if a is symbolic else purge(a)):




1aa a
124
139




Previous Up Next