python - Get vector space coordinates from symbolic polynomial -


i'm trying vector coordinates polynomial p in follow code assuming x,y , z belong gf(2) error

typeerror: can't initialize vector nonzero non-list.

how able fix that?

reset() var("x") var("y") var("z") pp = 2 k.<t>=gf(2^pp) vs = k.vector_space() p = z*x*t^2 + t*y + 1 print vs.coordinates(p) 

maybe can use coefficient list of polynomial vectoral coordinates, , may convert list vector. in case, better define gf(2^2) gf(4,'a')={0,1,a,a+1}.

for example may this:

sage k = gf(4,'a') r = polynomialring(gf(4,'a'),"x") x = r.gen() = k.gen() p = (a+1)*x^3 + x^2 + p.list() 

if need fix dimension n bigger value degree of p, may following;

n = 6 l = p.list(); l=len(l); = n-l; l_ = [0]*i; l.extend(l_) l 

gives 6-dimensional coordinates of p. if need use coefficient list vector afterwards, may use vector(l) instead of l.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -