On Tuesday, May 29, 2012 6:02:07 AM UTC+8, Oleksandr Kazymyrov wrote:
>
> Hi again,
>
> A try to use *log* function and got error:
> sage: R.<x>=ZZ[]
> sage: k.<a>=GF(2^8,modulus=x^8+x^4+x^3+x+1)
> sage: b=k.random_element()                 
> sage: b.log(a)                             
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
>
> /home/hamsin/<ipython console> in <module>()
>
> /home/hamsin/bin/sage/local/lib/python2.7/site-packages/sage/rings/finite_rings/element_givaro.so
>  
> in sage.rings.finite_rings.element_givaro.FiniteField_givaroElement.log 
> (sage/rings/finite_rings/element_givaro.cpp:11248)()
>
> /home/hamsin/bin/sage/local/lib/python2.7/site-packages/sage/groups/generic.pyc
>  
> in discrete_log(a, base, ord, bounds, operation, identity, inverse, op)
>     814         return  CRT_list(l,[pi**ri for pi,ri in f])
>     815     except ValueError:
> --> 816         raise ValueError, "No discrete log of %s found to base 
> %s"%(a,base)
>     817 
>     818 def discrete_log_generic(a, base, ord=None, bounds=None, 
> operation='*', identity=None, inverse=None, op=None):
>
> ValueError: No discrete log of a^7 + a^6 + a^5 + a^4 + a^2 + 1 found to 
> base a
>
> I also found some strangeness:
> sage: m=[a^i for i in xrange(255)]
> sage: m.append(0)
> sage: len(set(m))
> 52
>
> But last value must be 256, if *a *is a generator. So *k.gens() *returns 
> wrong value.
>
> P.S.
> sage: version()
> 'Sage Version 5.0, Release Date: 2012-05-14'
>
>
> On Monday, May 21, 2012 1:29:29 AM UTC+2, Oleksandr Kazymyrov wrote:
>>
>> Hello all.
>>
>> 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
>> sage: k.gen()
>> a
>> sage: k.list()
>> [0, a + 1, a^2 + 1, a^3 + a^2 + a + 1, a^4 + 1, a^5 + a^4 + a + 1, a^6 + 
>> a^4 + a^2 + 1, ... ]
>>
>> Generator is "a+1"!
>>
>> How to get generator of Finite Field? It was fine in Sage 4.8.
>>
>> Ubuntu 12.04
>> Linux hamsin 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:52 UTC 2012 
>> i686 i686 i386 GNU/Linux
>>
>> Best regards,
>> Oleksandr
>>
> I think what you are looking for is k.multiplicative_generator(). 

sage: c = k.multiplicative_generator() 
sage: log(a, c)
20

-- 
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