Yes, b.list() works instead of list(b).

There is also b.polynomial() which gives it as a polynomial over the prime 
field, so I could have done either Zy(b.list()) or Zy(b.polynomial()) as 
you can check.

I agree that b.coeffs() would make sense to have.  Also, the parent field 
F125 = GF(5^3) has a dual_basis() method but no basis() method, which is 
strange.  I think that finite fields should have a basis() method, giving 
their basis as a vector space over the prime field (or over its base field).

On Wednesday, 27 November 2024 at 09:58:13 UTC Dima Pasechnik wrote:

> I would have never guessed that list(b) works. Should there be b.list() or 
> b.coefs() ?
>
>
> On 27 November 2024 02:48:05 GMT-06:00, John Cremona <john.c...@gmail.com> 
> wrote:
>
>> 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/02b8aff6-c05b-4621-9d67-08678b139068n%40googlegroups.com.

Reply via email to