Macaulay2 » Documentation
Packages » Macaulay2Doc :: vector
next | previous | forward | backward | up | index | toc

vector -- make a vector

Synopsis

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

Ways to use vector :

For the programmer

The object vector is a method function.