Conversion from finite field to integer polynomial
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.
b.polynomial()
might be close to what you're looking for. You can also get the coefficients fromb.list()
.