up previous next
matrix

convert an expression into a matrix

Syntax
mat(R:RING, L:LIST):MAT
mat(L:LIST):MAT
where L is either: a rectangular lists of lists, or a module

Description
This function converts the expression E into a matrix.

When E is a LIST of LIST of RINGELEM all the elements must be in the same RING and the resulting matrix is in that RING. When E is a LIST of LIST of INT or RAT the resulting matrix is in QQ. When a RING is specified the resulting matrix will be in that RING (if possible).

Example
/**/  Use R ::= QQ[x,y];
/**/  L := [[1,2],[3,4]];
/**/  mat(L);
matrix( /*QQ*/
 [[1, 2],
  [3, 4]]
 )
/**/  mat(R,L);
matrix( /*RingDistrMPolyClean(QQ, 2)*/
 [[1, 2],
  [3, 4]]
 )
/**/  mat(ZZ,L);
matrix( /*ZZ*/
 [[1, 2],
  [3, 4]]
 )

/**/  RingOf(mat(R, [[1,2],[3,4]]));
RingDistrMPolyClean(QQ, 2)



  M := Module([x,x^2,y], [x^2,y,0]); --***OBSOLETE MANUAL: WORK IN PROGRESS***
  Mat(M);
Mat([
  [x, x^2, y],
  [x^2, y, 0]
])

See Also