next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > matrices > format and display of matrices in Macaulay 2

format and display of matrices in Macaulay 2

By default, Macaulay 2 displays matrices in a compact form.
i1 : QQ[x];
i2 : matrix{{x^2 + 3, x^4 + 1},{x^13 - 5, x^7 - 1}}

o2 = | x2+3  x4+1 |
     | x13-5 x7-1 |

                    2              2
o2 : Matrix (QQ [x])  <--- (QQ [x])
Note how the exponents of x have been placed to the right of x rather than formatted in superscript. While this format is generally considered to be desirable, this can be turned off by setting the variable compactMatrixForm to false.
i3 : compactMatrixForm = false

o3 = false
i4 : matrix{{x^2 + 3, x^4 + 1},{x^13 - 5, x^7 - 1}}

     |   2       4     |
o4 = |  x  + 3  x  + 1 |
     |                 |
     |  13       7     |
     | x   - 5  x  - 1 |

                    2              2
o4 : Matrix (QQ [x])  <--- (QQ [x])
To have Macaulay 2 display matrices in compact form again, type:
i5 : compactMatrixForm = true

o5 = true
i6 : matrix{{x^2 + 3, x^4 + 1},{x^13 - 5, x^7 - 1}}

o6 = | x2+3  x4+1 |
     | x13-5 x7-1 |

                    2              2
o6 : Matrix (QQ [x])  <--- (QQ [x])