next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: MatrixExpression

MatrixExpression -- the class of all matrix expressions

Description

MatrixExpression is a type of Expression representing a matrix.

i1 : MatrixExpression {{a,b,c},{a,bb,ccc}}

o1 = | a b  c   |
     | a bb ccc |

o1 : Expression of class MatrixExpression
i2 : R=QQ[x,y];
i3 : MatrixExpression {applyTable({{x^2-y^2,x^3-y^3},{x^2-4*y^2,x^3+y^3}},factor),Degrees=>{{{-2},{-3}},{{0},{0}}}}

o3 = {-2} | (x-y)(x+y)   (x-y)(x2+xy+y2) |
     {-3} | (x-2y)(x+2y) (x+y)(x2-xy+y2) |

o3 : Expression of class MatrixExpression
i4 : value oo

o4 = {-2} | x2-y2  x3-y3 |
     {-3} | x2-4y2 x3+y3 |

             2       2
o4 : Matrix R  <--- R

The optional argument CompactMatrix may be used with new MatrixExpression to specify whether the matrix should be displayed compactly.

i5 : R = QQ[x];
i6 : f = {{x^2,x^3}}

        2   3
o6 = {{x , x }}

o6 : List
i7 : new MatrixExpression from {f, CompactMatrix => false}

     |   2   3  |
o7 = |  x   x   |

o7 : Expression of class MatrixExpression
i8 : new MatrixExpression from {f, CompactMatrix => true}

o8 = | x2 x3 |

o8 : Expression of class MatrixExpression

The optional argument BlockMatrix may be used with new MatrixExpression to specify the numbers of rows and columns to use when displaying the matrix as a block matrix.

i9 : g = apply(4,i -> apply(4,j -> 10*i+j+10))

o9 = {{10, 11, 12, 13}, {20, 21, 22, 23}, {30, 31, 32, 33}, {40, 41, 42, 43}}

o9 : List
i10 : new MatrixExpression from { g, BlockMatrix => {{1,2},{3,1}}}

o10 = | 10 11 12 | 13 |
      +----------+----+
      | 20 21 22 | 23 |
      | 30 31 32 | 33 |
      | 40 41 42 | 43 |

o10 : Expression of class MatrixExpression

See also

For the programmer

The object MatrixExpression is a header type, with ancestor classes Expression < BasicList < Thing.