Search code examples
matrixvectorpolynomialsmacaulay2

Constructing a vector from a sequence in MacAulay2


I am in the following situation:

S=QQ[x_0..x_n];

for i from 0 to n do for j from i to n do d_{i,j} = x_i*x_j;

Now I would like to construct a vector whose elements are

d_{0,0}=x_0^2,d_{0,1}=x_0*x_1,...,d_{0,n}=x_0*x_n,d_{1,1}=x_1^2,d_{1,2}=x_1*x_2,...,d_{n,n}=x_n^2

How can I do this in MacAulay2? Thank you very much.


Solution

  • This may be what you are looking for.

    m=ideal(S_*)
    m^2_*
    

    The _* operator gets the generators of an ideal. So, m is the maximal ideal, and you are looking for the generators of m^2.

    Alternatively

    flatten entries basis(2,S)
    

    which simply gives you the vector basis of the ring S in degree 2.