Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » Matrix » Matrix _ Sequence
next | previous | forward | backward | up | index | toc

# Matrix _ Sequence -- get entry of matrix

- Operator: _
- Usage:
    `M_(i,j)`
- Inputs:
  - M, a matrix, or a mutable matrix
  - i, a sequence, both integers
- Outputs:
  - the (i,j)-th entry of the matrix M, where M_(0,0) is the top left entry, a ring element

## Description

All indexing in Macaulay2 is zero-based, so the indices start at zero.

    i1 : M = matrix{{1,2,3},{0,5,6}}

    o1 = | 1 2 3 |
         | 0 5 6 |

                  2       3
    o1 : Matrix ZZ  <-- ZZ

    i2 : M_(1,2)

    o2 = 6

The matrix may be a a mutable matrix too:

    i3 : N = mutableMatrix M

    o3 = | 1 2 3 |
         | 0 5 6 |

    o3 : MutableMatrix

    i4 : N_(1,0)

    o4 = 0

Entries of mutable matrices can be changed:

    i5 : N_(1,0) = 37

    o5 = 37

    i6 : N

    o6 = | 1  2 3 |
         | 37 5 6 |

    o6 : MutableMatrix

## See also

- Matrix -- the class of all matrices
- MutableMatrix -- the class of all mutable matrices

## Ways to use this method:

- Matrix _ Sequence -- get entry of matrix
- `MutableMatrix _ Sequence`

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/operators/underscore.m2:359:0.