Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

constructing a matrix from lists

Our goal is to build the 6×6 matrix whose rows are the coefficients of monomials z2,xy,y2,y3,y4,y5 of the six polynomials g(0,0,0),g(0,0,1),g(0,0,2),g(0,0,3),g(0,0,4),g(0,0,5)Z[x,y,z] such that gk,i,j=xiyjfk where f=x+y+z. My attempt in sage is to create a list L defining the monomials and computing the six as rows lists as follows.

R.<x,y,z>=ZZ['x, y, z']
f=x+y+z
L=[(2, 0, 0),(0, 1, 1),(0, 0, 2),(0, 0, 3),(0, 0, 4),(0, 0, 5)]
for (k,i,j) in L:
               g=x^i*y^j*f^k
               L1=[g[x^i*y^j*z^k] for (k,i,j) in L]
               print(L1)

A naive solution, since sage outputs 6 rows L1,L2,L3,L4,L5,L6, the resulting matrix is

matrix([L1,L2,L3,L4,L5,L6])

But in practice I manipulate with more 100 polynomials, so I want to get a solution which outputs directly the matrix.

constructing a matrix from lists

Our goal is to build the 6×6 matrix whose rows are the coefficients of monomials z2,xy,y2,y3,y4,y5 of the six polynomials g(0,0,0),g(0,0,1),g(0,0,2),g(0,0,3),g(0,0,4),g(0,0,5)Z[x,y,z] such that gk,i,j=xiyjfk where f=x+y+z. My attempt in sage is to create a list L defining the monomials and computing the six as rows lists as follows.

R.<x,y,z>=ZZ['x, y, z']
f=x+y+z
L=[(2, 0, 0),(0, 1, 1),(0, 0, 2),(0, 0, 3),(0, 0, 4),(0, 0, 5)]
for (k,i,j) in L:
               g=x^i*y^j*f^k
               L1=[g[x^i*y^j*z^k] for (k,i,j) in L]
               print(L1)

A naive solution, since sage outputs 6 rows L1,L2,L3,L4,L5,L6, the resulting matrix is

matrix([L1,L2,L3,L4,L5,L6])

But in practice I manipulate with more than 100 polynomials, so I want to get a solution which outputs directly the matrix.