Use list() to get the coefficients:

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: Zy.<y> = ZZ[]
sage: Zy(list(b))
4*y^2 + 3*y + 1

On Wednesday, 27 November 2024 at 06:51:57 UTC Dima Pasechnik wrote:

> A natural way would be to construct the quotient ring of GF(5)[x]  modulo 
> (P), then b will be a polynomial in x, and you will have direct access to 
> its coefficients.
>
>
> On 26 November 2024 16:46:50 GMT-06:00, "G. M.-S." <list...@gmail.com> 
> wrote:
>
>>
>> Already asked on
>>
>> https://ask.sagemath.org/question/80389/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.
>>
>> TIA,
>>
>> Guillermo
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-support/453487fb-6288-4335-a457-e6f58ed47e78n%40googlegroups.com.

Reply via email to