1 | initial version |
Hints:
Here is an example which hopefully addresses the question.
Define a number field:
sage: p = 29
sage: n = 2
sage: F.<x> = GF(p^n)
Define a polynomial ring over the integers.
sage: R = PolynomialRing(ZZ, 't')
Now, convert a list of coefficients (from degree 0 to degree n) into a polynomial.
sage: u = [7, 4] # careful: start from degree 0 coefficient
sage: g = R(u)
sage: g
4*t + 7
Now, turn this polynomial into a finite field element:
sage: z = F(g)
sage: z
4*x + 7
Combining this (again, careful with order of coefficients), define lists of lists of coefficients:
sage: u1 = [[7, 4], [1, 3]]
sage: u2 = [[1, 3], [2, 5]]
turn them into vectors:
sage: v1 = vector(F, [R(u) for u in u1])
sage: v2 = vector(F, [R(u) for u in u2])
and now you can add them:
sage: v1 + v2
(7*x + 8, 8*x + 3)