Hi,

K.gen() returns the thing we represent field elements in, but not necessarily 
the field generator. 


1) However, the documentation is wrong:

"""
Return a generator of self. All elements x of self are expressed as  
log_{self.gen()}(p) internally
"""

This should be fixed and a reference to multiplicative_generator() added.

2) K.multiplicative_generator() currently returns a random generator, but for 
the GivaroGFq implementation we should simply return the generator which has 
internal representation '1', i.e., the guy we actually use to represent the 
elements. Once this done log_repr() will also start to make sense again.

Olexandr, would those fixes solves your confusion/problem?

On Sunday 03 Jun 2012, Oleksandr Kazymyrov wrote:
> I have used log_repr() and expect that it return y of equation x^y = z. I
> also believed  hat k.gen() return generator of the field.
> 
> Now I must use following construction for solving my problem
> sage: R.<x>=ZZ[]
> sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> sage: a = k.multiplicative_generator()
> sage: a^ZZ(k(ZZ(3).digits(2)).log(a)) == k(ZZ(3).digits(2))
> 
> By the way, any of next functions don't return the value y of equation
> x^y=z sage: b=K(ZZ(3).digits(2))
> sage: b
> a + 1
> sage: b.log_repr()
> '1'
> sage: b.log_to_int()
> 3
> 
> I think that log_repr() should has the same logic as int_repr() or
> integer_representation(), i.e.
> sage: a=K.multiplicative_generator()
> sage: ZZ(K(ZZ(3).digits(2)).log(a))
> 164
> 
> What do you think?
> 
> Kind regards,
> Oleksandr
> 
> On Tuesday, May 29, 2012 12:52:16 PM UTC+3, AlexGhitza wrote:
> > Hi,
> > 
> > On Mon, May 21, 2012 at 9:29 AM, Oleksandr Kazymyrov
> > 
> > <vrona.aka.ham...@gmail.com> wrote:
> > > I have encountered the following problem In Sage 5.0:
> > > sage: R.<x>=ZZ[]
> > > sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> > > sage: k(ZZ(3).digits(2))
> > > a + 1
> > > sage: k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr())
> > > a
> > > sage:  k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> > > False
> > > sage: k("a+1")^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> > > True
> > > 
> > > It easy see that k.gen() or k.multiplicative_generator() is not a
> > 
> > generator
> > 
> > > of the finite field:
> > > sage: k.multiplicative_generator()
> > > a^4 + a + 1
> > 
> > Why is it clear that a^4+a+1 is not a multiplicative generator?  I think
> > it is:
> > 
> > sage: k.<a> = GF(2^8, names='a', name='a', modulus=x^8+x^4+x^3+x+1)
> > sage: (a^4+a+1).multiplicative_order()
> > 255
> > 
> > Indeed, so is a+1:
> > sage: (a+1).multiplicative_order()
> > 255
> > 
> > The docs for multiplicative_generator() say: "return a generator of
> > the multiplicative group", then add "Warning: This generator might
> > change from one version of Sage to another."

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to