Hi again. Maybe following two options will be useful for you sage: K.<a>=GF(2^8,repr='int') sage: K.<a>=GF(2^8,repr='log')
Here <http://pastebin.com/raw.php?i=pMy3dpEE> is the link to functions for converting polynomials over a finite find using a multiplicative generator. I took them from my class, so you should rewrite them a bit for your implementation. On Tuesday, September 18, 2012 11:12:13 PM UTC+2, Mike OS wrote: > > Thanks Oleksandr, > > I found b.log, but what I would like is for the default printing of a > field element in > F.<a> = GF(256) > to be 0 or a^t for some t in [0..254]. > This is partly for legibility when I create polynomials over F. > A coefficient of the from a^t is much easier to read than one that is a > degree 7 polynomial in a > > Mike > > On Monday, September 17, 2012 2:46:05 PM UTC-7, Oleksandr Kazymyrov wrote: >> >> Today is easiest way and *secure* to use multiplicative_generator >> function: >> >> sage: K=GF(2^4,'a') >> sage: K >> Finite Field in a of size 2^4 >> sage: b=K.random_element() >> sage: b.log(K.multiplicative_generator()) >> 14 >> sage: K.multiplib.log(K.multiplicative_generator()) >> K.multiplication_table K.multiplicative_generator >> sage: K.multiplicative_generator()^b.log(K.multiplicative_generator()) == >> b >> True >> >> Because the function log_repr() works only in some special cases. >> sage: K=GF(2^4,'a',modulus=ZZ['x']('x^4 + x^3 + x^2 + x + 1')); >> sage: K.list() >> [0, a + 1, a^2 + 1, a^3 + a^2 + a + 1, a^3 + a^2 + a, a^3 + a^2 + 1, a^3, >> a^2 + a + 1, a^3 + 1, a^2, a^3 + a^2, a^3 + a + 1, a, a^2 + a, a^3 + a, 1] >> sage: b=K.random_element() >> sage: b >> a^3 + a >> sage: b.log_repr() >> '14' >> sage: b^ZZ(b.log_repr()) == b >> False >> sage: K.multiplicative_generator() >> >> a^2 + a + 1 >> sage: >> K.multiplicative_generator()^ZZ(b.log(K.multiplicative_generator())) == b >> True >> >> On Monday, September 17, 2012 11:07:58 PM UTC+2, Mike OS wrote: >>> >>> HI >>> >>> I was asking myself this question and couldn't find an answer in the >>> documentation, not >>> in past posts (which is how I found this email). >>> >>> So I re-ask the question is there a way to have finite field elements >>> printed as powers of the primitive element? >>> >>> Thanks >>> >>> Mike >>> >>> On Saturday, October 31, 2009 2:34:38 AM UTC-7, Kwankyu wrote: >>>> >>>> Hi, >>>> >>>> Is it possible to get elements of a finite field printed as powers of >>>> a primitive element if the modulus is a primitive polynomial? That >>>> will save a lot of screen space. >>>> >>>> >>>> Kwankyu >>> >>> -- You received this message because you are subscribed to the Google Groups "sage-support" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support?hl=en.
