[next][up][top][index]
search for:

input a matrix

Sections:

  • by its entries
  • by a function
  • identity matrix
  • by its entries

    Using the function matrix is the most basic method for inputting a matrix. The entries are typed in by rows.

    i1 : R = ZZ/5[s..z];
    i2 : M = matrix {{ x^2+y, z^3}, {y^3-z,3*z-6*x-5*y}}

    o2 = | x2+y z3    |
         | y3-z -x-2z |

                 2       2
    o2 : Matrix R  <--- R

    by a function

    The function map can be used to construct matrices.

    i3 : G = map(R^3,3,(i,j)->R_i^j)

    o3 = | 1 s s2 |
         | 1 t t2 |
         | 1 u u2 |

                 3       3
    o3 : Matrix R  <--- R
    i4 : f = 3*s^2*v-t*u*v+s*t^2

            2     2
    o4 = s*t  - 2s v - t*u*v

    o4 : R
    i5 : H = map(R^4,R^4,(i,j)->diff(R_j*R_i,f))

    o5 = | v  2t 0  s  |
         | 2t 2s -v -u |
         | 0  -v 0  -t |
         | s  -u -t 0  |

                 4       4
    o5 : Matrix R  <--- R

    identity matrix

    The function id is used to form the identity matrix as a map from a module to itself.

    i6 : id_(R^3)

    o6 = | 1 0 0 |
         | 0 1 0 |
         | 0 0 1 |

                 3       3
    o6 : Matrix R  <--- R
    i7 : id_(coker M)

    o7 = | 1 0 |
         | 0 1 |

    o7 : Matrix

    The first example gives a 3x3 identity matrix formed in the ambient ring.


    [next][up][top][index]
    search for: