Ask Your Question

Coefficient of polynomial in a Finite field

asked 2016-06-06 22:11:12 -0600

vishb gravatar image

Consider the following code :-

for a in range(10000,10000000):
    if L.count(0)>1:
        print "special low support %d" %a
        for i in range(100):
            if L[i]==0:
                print i

I want the list of coefficient of f(y) but when L is a field (which it for the above stated parameters ) it is giving this error.

t' object has no attribute 'list'

when L is a ring it is working perfectly. Also when I try to use f.coeff() it basically consider f(y) as a constant.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-07 04:07:22 -0600

B r u n o gravatar image

To get the coefficients, you need to view f as a polynomial in y, using f.polynomial(). Then list gives you the list of all coefficients, while coefficients gives you the list of nonzero coefficients:

sage: p = 104711
sage: r = 101
sage: K = GF(p)
sage: L.<y> = K.extension(cyclotomic_polynomial(r))
sage: f = (y+1)^10
sage: f.polynomial().list()
[1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1]
sage: f.polynomial().coefficients() # no difference since all coefficients are nonzero
[1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1]
sage: f = (y+1)^100
sage: len(f.polynomial().list())
sage: len(f.polynomial().coefficients()) # one zero coefficient
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-06-06 22:11:12 -0600

Seen: 454 times

Last updated: Jun 07 '16