


![[top]](top.gif)
genericSymmetricMatrix(R,x,n) -- make a symmetric n by n matrix whose entries on and above the diagonal are the variables of R, starting with the variable x.
Code:
-- ../../../Macaulay2/m2/genmat.m2:29-36
genericSymmetricMatrix = (R,first,n) -> (
first = getIndex(R,first);
vars := new MutableHashTable;
nextvar := first;
scan(0..n-1, i -> scan(i..n-1, j -> (
vars#(i,j) = R_nextvar;
nextvar = nextvar+1)));
matrix table(n,n, (i,j) -> if i>j then vars#(j,i) else vars#(i,j)))



![[top]](top.gif)