Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » lists and sequences » BasicList » Vector » vector
next | previous | forward | backward | up | index | toc

vector -- make a vector

Description

For any $R$-module $M$, there exists an isomorphism between $\operatorname{Hom}(R,M)$ and $M$ given by $f\mapsto f(1)$. Therefore, internally all Vector objects representing elements of $M$ correspond to matrices with source $R^1$ and target $M$. A vector may be constructed from such a matrix using vector.

i1 : R = QQ[x,y,z]

o1 = R

o1 : PolynomialRing
i2 : f = matrix {{x}, {y}, {z}}

o2 = | x |
     | y |
     | z |

             3      1
o2 : Matrix R  <-- R
i3 : vector f

o3 = | x |
     | y |
     | z |

      3
o3 : R

Alternatively, $M$ may be specified if it differs from the target of the matrix.

i4 : g = matrix {{1}, {2}, {3}}

o4 = | 1 |
     | 2 |
     | 3 |

              3       1
o4 : Matrix ZZ  <-- ZZ
i5 : vector(R^3, g)

o5 = | 1 |
     | 2 |
     | 3 |

      3
o5 : R

If the matrix would have only one element, then that element may be given instead. If the module is not provided, then the result will be an element of the free module of rank one of the ring of the given element.

i6 : vector 2

o6 = | 2 |

       1
o6 : ZZ
i7 : vector x

o7 = | x |

      1
o7 : R
i8 : vector(R^1, 2)

o8 = | 2 |

      1
o8 : R

Alternatively, a list of elements may be provided. If the module is not specified, then the vector will be an element of a free module over a ring containing all the elements of the list.

i9 : vector {1, 2, 3}

o9 = | 1 |
     | 2 |
     | 3 |

       3
o9 : ZZ
i10 : vector {1, x, y}

o10 = | 1 |
      | x |
      | y |

       3
o10 : R
i11 : vector(R^3, {1, 2, 3})

o11 = | 1 |
      | 2 |
      | 3 |

       3
o11 : R

Alternatively, the ring $R$ may be provided instead of $M$, and the resulting vector will be an element of the appropriate free module over $R$.

i12 : vector(QQ, {1, 2, 3})

o12 = | 1 |
      | 2 |
      | 3 |

        3
o12 : QQ
i13 : vector(R, {1, 2, 3})

o13 = | 1 |
      | 2 |
      | 3 |

       3
o13 : R
i14 : vector(R, 2)

o14 = | 2 |

       1
o14 : R

Ways to use vector:

  • vector(List)
  • vector(Matrix)
  • vector(Module,List)
  • vector(Module,Matrix)
  • vector(Module,Number)
  • vector(Module,RingElement)
  • vector(Number)
  • vector(Ring,List)
  • vector(Ring,Matrix)
  • vector(Ring,Number)
  • vector(Ring,RingElement)
  • vector(RingElement)
  • vector(RingFamily,List)
  • vector(RingFamily,Matrix)
  • vector(RingFamily,Number)
  • vector(RingFamily,RingElement)

For the programmer

The object vector is a method function.


The source of this document is in Macaulay2Doc/doc_module.m2:292:0.