Ask Your Question
1

Conversion from finite field to integer polynomial

asked 0 years ago

GMS103 gravatar image

I am looking for a function myf doing the following:

sage: var('x')
x
sage: P=x^3-2*x^2-x-2
sage: F125.<a>=GF(5^3,name='a',modulus=P)
sage: b=a^37;b
4*a^2 + 3*a + 1
sage: c=myf(b,y)
1 + 3*y + 4*y^2
sage: c.parent()
Power Series Ring in y over Integer Ring

or better still (symmetric representation):

sage: c=myf(b,y)
1 - 2*y - y^2
sage: c.parent()
Power Series Ring in y over Integer Ring

I can manage with str, replace, preparse, eval but there is surely a natural way.

Preview: (hide)

Comments

b.polynomial() might be close to what you're looking for. You can also get the coefficients from b.list().

John Palmieri gravatar imageJohn Palmieri ( 0 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 0 years ago

rburing gravatar image

Here is a more natural way to do it:

sage: R.<y> = PowerSeriesRing(ZZ)
sage: R(b.polynomial().map_coefficients(lambda c: c.lift(), new_base_ring=ZZ))
1 + 3*y + 4*y^2
sage: R(b.polynomial().map_coefficients(lambda c: c.lift_centered(), new_base_ring=ZZ))
1 - 2*y - y^2
Preview: (hide)
link

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: 0 years ago

Seen: 143 times

Last updated: Nov 29 '24