Consider the ring
R and the matrix
f.
i1 : R = QQ[x,y,z];

i2 : f = matrix{{2,x,y,x^2},{z,32,2,x}}
o2 =  2 x y x2 
 z 32 2 x 
2 4
o2 : Matrix R < R

target
From the above output, one sees that Macaulay2 considers
f as a linear transformation. Use the
target command to obtain the target of the linear transformation
f.
i3 : target f
2
o3 = R
o3 : Rmodule, free

source
Likewise, to obtain the source of our linear transformation, use the
source command.
i4 : source f
4
o4 = R
o4 : Rmodule, free, degrees {3:1, 2}

number of rows or columns
Use
numgens to obtain the rank of a free module. Combining it with the commands
target or
source gives us a way to determine the number of rows or columns of a matrix
f.
i5 : numgens target f
o5 = 2

i6 : numgens source f
o6 = 4

extracting an element from a matrix
To extract the
(i,j)th element of a matrix, type
f_(i,j).
i7 : f_(1,3)
o7 = x
o7 : R

Note that the first number selects the row, starting at
0 and the second number selects the column, also starting at
0.
entries of a matrix
To obtain the entries of a matrix in the form of a list of lists, use the
entries command.
i8 : entries f
2
o8 = {{2, x, y, x }, {z, 32, 2, x}}
o8 : List

Note that each inner list is a list of elements from a row of
f.
ring
The
ring command can be used to return the ring of the matrix, that is, the ring containing entries of the matrix.
i9 : ring f
o9 = R
o9 : PolynomialRing

Use the
describe command to recover how the ring of
f was constructed.
i10 : describe ring f
o10 = QQ[x..z, Degrees => {3:1}, Heft => {1}]
