type/matrix - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/matrix

type/matrix

check for a matrix

 Calling Sequence type(A, matrix) type(A, 'matrix'(R)) type(A, 'matrix'(R, square))

Parameters

 A - expression R - type -- type of the coefficient ring

Description

 • This function checks whether its first argument is a Maple matrix. A matrix is defined to be a two-dimensional array with indices starting at 1.
 • If the argument R is given, the function checks whether A is a matrix with entries from the domain R.
 • If the argument square is given, then the function also checks if A is a square matrix.
 • When the second or third syntax is used, it is essential to quote the word matrix in order to avoid confusion with the matrix function in the linalg package.
 • Note: The command matrix has been superseded by Matrix.

Examples

 > $\mathrm{type}\left(\mathrm{Array}\left(1..2,1..2\right),\mathrm{matrix}\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{type}\left(\mathrm{Array}\left(0..2,0..2\right),\mathrm{matrix}\right)$
 ${\mathrm{false}}$ (2)
 > $A≔\mathrm{linalg}\left[\mathrm{matrix}\right]\left(2,3,\left[1,2,3,4,\frac{5}{2},6\right]\right)$
 ${A}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\\ {4}& \frac{{5}}{{2}}& {6}\end{array}\right]$ (3)
 > $\mathrm{type}\left(A,'\mathrm{matrix}'\left(\mathrm{integer}\right)\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{type}\left(A,'\mathrm{matrix}'\left(\mathrm{rational}\right)\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{type}\left(A,'\mathrm{matrix}'\left(\mathrm{rational},\mathrm{square}\right)\right)$
 ${\mathrm{false}}$ (6)