up previous next
2.13.1 Introduction to MAT
An m x n matrix is represented in CoCoA by the list of its rows (see matrix ). The (A,B)-th entry of a matrix M is given by M[A][B] or M[A,B] .

The following operations are defined as one would expect for matrices
  M^A, +M, -N, M+N, M-N, M*N, F*M, M*F
where M, N are matrices, A is a non-negative integer, and F is a polynomial, with the obvious restrictions on the dimensions of the matrices involved.

Example
/**/  use R ::= QQ[x,y];
/**/  N := matrix(R, [[1,2],[3,4]]);
/**/  N[1,2];
2;

/**/  N^2;
matrix( /*RingWithID(3, "QQ[x,y]")*/
 [[7, 10],
  [15, 22]])

/**/  x * N;
matrix( /*RingWithID(3, "QQ[x,y]")*/
 [[x, 2*x],
  [3*x, 4*x]])

/**/  N + matrix([[x,x], [y,y]]);
matrix( /*RingWithID(3, "QQ[x,y]")*/
 [[x +1, x +2],
  [y +3, y +4]])