Re: [sage-devel] Coercion between finite fields

2015-09-17 Thread Jeroen Demeyer
On 2015-09-17 12:32, Jean-Pierre Flori wrote: Don't we have a random keyword as well? Not a random keyword, but a modulus="random" argument (there are several more algorithms to choose a modulus) -- You received this message because you are subscribed to the Google Groups "sage-devel" group.

Re: [sage-devel] Coercion between finite fields

2015-09-17 Thread Jean-Pierre Flori
On Thursday, September 17, 2015 at 12:24:07 PM UTC+2, Jeroen Demeyer wrote: > > On 2015-09-17 11:56, Volker Braun wrote: > > Two comments: > > > > A) There is no such thing as "different finite fields of the same size > > with the same generator name" > > Of course there is: > > sage: GF(8,

Re: [sage-devel] Coercion between finite fields

2015-09-17 Thread Jeroen Demeyer
On 2015-09-17 11:56, Volker Braun wrote: Two comments: A) There is no such thing as "different finite fields of the same size with the same generator name" Of course there is: sage: GF(8, 'a') is GF(8, 'a', modulus="adleman-lenstra") False -- You received this message because you are subscri

Re: [sage-devel] Coercion between finite fields

2015-09-17 Thread Volker Braun
Two comments: A) There is no such thing as "different finite fields of the same size with the same generator name" sage: GF(4, 'a') is GF(4, 'a') True sage: GF(4, 'a') is GF(4, 'b') False There is no way to cast finite field elements to other finite field elements apart from the prime subfiel

Re: [sage-devel] Coercion between finite fields

2015-09-17 Thread Nathann Cohen
> The question is really: is the map between representations of the same > finite field, which differ only in variable name, "canonical"? I would say that there is no big risk to do that, though I am not at all knowledgeable on those parts of the code. If it can be dangerous but can be detected, h

Re: [sage-devel] Coercion between finite fields

2015-09-17 Thread Jeroen Demeyer
On 2015-09-16 16:43, Jean-Pierre Flori wrote: Hi, I guess one of the issue is that there is no canonical map between two different representations of the same finite field (so no coercion). The question is really: is the map between representations of the same finite field, which differ only

Re: [sage-devel] Coercion between finite fields

2015-09-16 Thread Nathann Cohen
>> If it is "doable", then indeed it would solve my problem and (to me) >> does not seem to induce any tricky behaviour. > > In this case: > > sage: [x.polynomial() for x in K1] > [0, a, a^2, a + 1, a^2 + a, a^2 + a + 1, a^2 + 1, 1] > sage: [K2(x.polynomial()) for x in K1] > [0, b, b^2, b + 1, b^2

Re: [sage-devel] Coercion between finite fields

2015-09-16 Thread John Cremona
On 16 September 2015 at 15:52, Nathann Cohen wrote: > Hello, > >> In your case it is slightly more specific as it might be the case that K1 >> and K2 are constructed in the same exact way (expect for the string 'a' and >> 'b') so we could just decide to send "a" onto "b", but I'm not sure it is

Re: [sage-devel] Coercion between finite fields

2015-09-16 Thread Nathann Cohen
Hello, > In your case it is slightly more specific as it might be the case that K1 and > K2 are constructed in the same exact way (expect for the string 'a' and 'b') > so we could just decide to send "a" onto "b", but I'm not sure it is very > helpful to define an exception in this case. If it

Re: [sage-devel] Coercion between finite fields

2015-09-16 Thread Jean-Pierre Flori
Hi, I guess one of the issue is that there is no canonical map between two different representations of the same finite field (so no coercion). In your case it is slightly more specific as it might be the case that K1 and K2 are constructed in the same exact way (expect for the string 'a' and '

Re: [sage-devel] Coercion between finite fields

2015-09-16 Thread Nathann Cohen
> > GF(4) is not a subfield of GF(8). > Oh. Right. Actually, the problem with my code happened when both finite fields were equal, and I wrote this message without thinking. sage: K1 = GF(8,'a') sage: K2 = GF(8,'b') sage: K2(K1(1)) TypeError: unable to coerce from a finite fiel

Re: [sage-devel] Coercion between finite fields

2015-09-16 Thread John Cremona
GF(4) is not a subfield of GF(8). John On 16 September 2015 at 10:16, Nathann Cohen wrote: > Hello everybody, > > I am rather ignorant of Sage matters when it comes to finite fields. I have > been playing with matrices for a while, working around a bug that I did not > understand. It is now solv

[sage-devel] Coercion between finite fields

2015-09-16 Thread Nathann Cohen
Hello everybody, I am rather ignorant of Sage matters when it comes to finite fields. I have been playing with matrices for a while, working around a bug that I did not understand. It is now solved, but here is what it boils down to: sage: K1 = GF(4,'w') sage: K2 = GF(8,'x') sage: K2(