On Wed, Jan 20, 2016 at 7:47 PM, Nils Bruin <nbr...@sfu.ca> wrote:

> On Wednesday, January 20, 2016 at 3:22:54 PM UTC-8, Dima Pasechnik wrote:
>>
>>
>> to me,  two fields that are specified by the same irreducible polynomial
>> over the same prime subfield ought to be identical.
>> it'd be much better design, not wedding them to named generators at all.
>>
>> That's not compatible with the coercion model in sage where
>
> Z['x'] coerces into QQ['x'] and QQ['u','x','v'], but not into QQ['y']
>
> Names of generators are part of the identity of a structure in sage. With
> respect to polynomial rings this allows for various automatic behaviours
> that are out of reach for other computer algebra systems, so we are getting
> a benefit from it. It also has unfortunate and/or counterintuitive
> consequences in other cases; for you this may be one of them. It'll be way
> too invasive to change sage's concepts at this stage, so I think we'll have
> to live with it. Currently the generator name is important for finite
> fields:
>
> sage: GF(64,'x').0+GF(64,'y').0
> TypeError: unsupported operand parent(s) for '+'
>

I agree that it would be quite intrusive to remove the concept of variable
names from finite fields.  What if GF(p^n) were equivalent to
GF(p).algebraic_closure().subfield(n)[0] ?  Here's a quick timing
comparison (a bit noisy since I ran only once in order to eliminate caching
effects)

sage: for p in prime_range(2,20):
....:     print p,
timeit("L=GF(p).algebraic_closure().subfield(12)[0]",number=1,repeat=1)
2 1 loops, best of 1: 256 ms per loop
3 1 loops, best of 1: 33.1 ms per loop
5 1 loops, best of 1: 9.18 ms per loop
7 1 loops, best of 1: 8.25 ms per loop
11 1 loops, best of 1: 6.36 ms per loop
13 1 loops, best of 1: 6.23 ms per loop
17 1 loops, best of 1: 9.78 ms per loop
19 1 loops, best of 1: 6.56 ms per loop

sage: for p in prime_range(2,20):
....:     print p, timeit("L=GF(p^12,'x')",number=1,repeat=1)
2 1 loops, best of 1: 230 ms per loop
3 1 loops, best of 1: 34.6 ms per loop
5 1 loops, best of 1: 2.69 ms per loop
7 1 loops, best of 1: 2.4 ms per loop
11 1 loops, best of 1: 3.34 ms per loop
13 1 loops, best of 1: 2.19 ms per loop
17 1 loops, best of 1: 2.07 ms per loop
19 1 loops, best of 1: 11.9 ms per loop

There seems to be some speed penalty to my suggestion, but it's not too
bad.  And if you care you can always use a variable name....
David

> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to