Ask Your Question
0

Add Polynominals to Matrix.

asked 2018-11-06 11:52:47 -0600

Kognor gravatar image

Hello, I have a polynomianl coefficients in Vector1 = [[4,7],[3,1]]. I can`t add polynominal in Matrix. In result i need Matrix =Gf(p^n),1,n) = {4x+7,3x+1}. But i can do it in manually. Vector2=Matrix(Gf(p^n),1,n)) Vector2[0,0]=Vector1[0] Vector2[0,1]=Vector1[1] And in result i have need matrix. how do this right.

P.S. Sorry, English it is not my native language.

edit retag flag offensive close merge delete

Comments

Please describe mathematically what is needed, then we can see how to come together. Simple questions: We want a $2\times 2$ matrix with entries in the polynomial ring over some finite field? Please use then LaTeX to declare it explicitly. Please define $n$, better, give an example with a fixed $n$.

dan_fulea gravatar imagedan_fulea ( 2018-11-06 14:06:25 -0600 )edit

Is this a correct rephrasing of your question?

I have a list of polynomial coefficients stored as Vector1 = [[4, 7], [3, 1]].

I need to transform that into a matrix over GF(p^n) which would look like {4*x+7, 3*x+1}, and that could be added to another matrix.

Stored as above, adding vectors does not work as expected.

But i can do it in manually.

Vector2 = Matrix(Gf(p^n), 1, n)
Vector2[0, 0] = Vector1[0]
Vector2[0, 1] = Vector1[1]

And in result I need a matrix. How do this right.

slelievre gravatar imageslelievre ( 2018-11-09 10:49:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-09 10:44:22 -0600

slelievre gravatar image

Hints:

  • one can easily convert a list of numbers into a polynomial.
  • one can easily convert a polynomial into a finite field element.

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)
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

Stats

Asked: 2018-11-06 11:52:47 -0600

Seen: 46 times

Last updated: Nov 09