ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 02 Aug 2017 08:33:49 +0200Equivalent of Polynomial.list() for expression involving generator of GaloisFieldhttps://ask.sagemath.org/question/38458/equivalent-of-polynomiallist-for-expression-involving-generator-of-galoisfield/I know that it is possible to use the method list() to get a list with the coefficients of a polynomial. For instance:
sage: S.<x> = PolynomialRing(ZZ, 'x')
sage: (1 - 5*x + 3*x**2 + 2*x**3).list()
[1, -5, 3, 2]
I would like to do something like that with an expression involving a generator of a Galois Field.
For example:
sage: q = 5
sage: m = 2
sage: F.<a> = GF(q**m)
sage: a**9
3*a + 1
So, ideally, I would like to do the following
(a**9).list()
and get
[1, 3]
Is there any simple way to that?Wed, 02 Aug 2017 00:43:08 +0200https://ask.sagemath.org/question/38458/equivalent-of-polynomiallist-for-expression-involving-generator-of-galoisfield/Answer by tmonteil for <p>I know that it is possible to use the method list() to get a list with the coefficients of a polynomial. For instance:</p>
<pre><code>sage: S.<x> = PolynomialRing(ZZ, 'x')
sage: (1 - 5*x + 3*x**2 + 2*x**3).list()
[1, -5, 3, 2]
</code></pre>
<p>I would like to do something like that with an expression involving a generator of a Galois Field.</p>
<p>For example:</p>
<pre><code>sage: q = 5
sage: m = 2
sage: F.<a> = GF(q**m)
sage: a**9
3*a + 1
</code></pre>
<p>So, ideally, I would like to do the following</p>
<pre><code>(a**9).list()
</code></pre>
<p>and get</p>
<pre><code>[1, 3]
</code></pre>
<p>Is there any simple way to that?</p>
https://ask.sagemath.org/question/38458/equivalent-of-polynomiallist-for-expression-involving-generator-of-galoisfield/?answer=38459#post-id-38459You are close to the solution: just turn your field element into a polynomial in the undeterminate `a`:
sage: (a**9).polynomial().list()
[1, 3]
Wed, 02 Aug 2017 00:53:56 +0200https://ask.sagemath.org/question/38458/equivalent-of-polynomiallist-for-expression-involving-generator-of-galoisfield/?answer=38459#post-id-38459Comment by Hilder Vitor Lima Pereira for <p>You are close to the solution: just turn your field element into a polynomial in the undeterminate <code>a</code>:</p>
<pre><code>sage: (a**9).polynomial().list()
[1, 3]
</code></pre>
https://ask.sagemath.org/question/38458/equivalent-of-polynomiallist-for-expression-involving-generator-of-galoisfield/?comment=38461#post-id-38461That works! I had tried similar things, but not really that. Thank you!Wed, 02 Aug 2017 08:33:49 +0200https://ask.sagemath.org/question/38458/equivalent-of-polynomiallist-for-expression-involving-generator-of-galoisfield/?comment=38461#post-id-38461