Ask Your Question
1

Conversion from finite field to integer polynomial

asked 2024-11-26 21:46:45 +0100

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.

edit retag flag offensive close merge delete

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 ( 2024-11-28 23:10:55 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-11-29 11:28:04 +0100

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
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: 2024-11-26 16:37:56 +0100

Seen: 78 times

Last updated: Nov 29