previous  next
Mat
Syntax
Mat(E):MAT
Mat[E]:MAT

where E is either: a 'rectangular' lists of lists, a vector, or a
module.
Summary
convert an expression into a matrix
Description
This function converts the expression E into a matrix.  The first form
is equivalent to Cast(E,MAT).

Example

Use R ::= Q[x,y];
L := [[1,2],[3,4]];
Mat(L);
Mat[
  [1, 2],
  [3, 4]
]
-------------------------------
M := Module([x,x^2,y],[x^2,y,0]);
Mat(M);
Mat[
  [x, x^2, y],
  [x^2, y, 0]
]
-------------------------------
Mat([[1,2],[3,4]]);  -- note the syntax here
 Mat[
  [1, 2],
  [3, 4]
]
-------------------------------
Mat[[1,2],[3,4]];    -- and here
Mat[
  [1, 2],
  [3, 4]
]
-------------------------------
M:=Mat([['a','b'],['c',[1,2]]]);  -- a slightly more obscure example
N:=Mat([['d','e'],['f',[3,4]]]);
M+N;
Mat[
  ["ad", "be"],
  ["cf", [4, 6]]
]
-------------------------------
See also: