![]() | 1 | initial version |
First of all that in
does not translate (mathematically and/or pythonically) as an inclusion. The following works:
p, r, s, rs = 2, 16, 16, 256
Fp = GF(p)
Fr.<a> = GF(r)
Fs.<b> = GF(s)
Frs.<c> = GF(rs)
Now we have some fields and ask for existent coercion maps.
sage: Fr.has_coerce_map_from(Fp)
True
sage: Fs.has_coerce_map_from(Fp)
True
sage: Frs.has_coerce_map_from(Fp)
True
sage: Frs.has_coerce_map_from(Fr)
False
sage: Frs.has_coerce_map_from(Fs)
False
Why False
when false? Because for instance a
is an element inside $\Bbb F_{16}=\Bbb F_2(a)$ and we do not have a canonical choice of it inside the field $\Bbb F_{256}$ realized as $\Bbb F_2(c)$. Explicitly, every root of the minimal polynomial of $a$ from the last field gives rise to a possible injection between fields, $\Bbb F_2(a)\to \Bbb F_2(c)$:
sage: a.minimal_polynomial().roots(ring=Frs)
[(c^6 + c^3 + c^2 + c, 1),
(c^6 + c^3 + c^2 + c + 1, 1),
(c^7 + c^4 + c^3, 1),
(c^7 + c^4 + c^3 + 1, 1)]
So which coercion should sage or a friend chose for us?
Note: Posting as an Anonymous is possible, but the dialog suffers if there is a follow up...
![]() | 2 | No.2 Revision |
First of all that in
does not translate (mathematically and/or pythonically) as an inclusion. The following works:
p, r, s, rs = 2, 16, 16, 256
Fp = GF(p)
Fr.<a> = GF(r)
Fs.<b> = GF(s)
Frs.<c> = GF(rs)
Now we have some fields and ask for existent coercion maps.
sage: Fr.has_coerce_map_from(Fp)
True
sage: Fs.has_coerce_map_from(Fp)
True
sage: Frs.has_coerce_map_from(Fp)
True
sage: Frs.has_coerce_map_from(Fr)
False
sage: Frs.has_coerce_map_from(Fs)
False
Why False
when false? Because for instance a
is an element inside $\Bbb F_{16}=\Bbb F_2(a)$ and we do not have a canonical choice of it inside the field $\Bbb F_{256}$ realized as $\Bbb F_2(c)$. Explicitly, every root of the minimal polynomial of $a$ from the last field gives rise to a possible injection between fields, $\Bbb F_2(a)\to \Bbb F_2(c)$:
sage: a.minimal_polynomial().roots(ring=Frs)
[(c^6 + c^3 + c^2 + c, 1),
(c^6 + c^3 + c^2 + c + 1, 1),
(c^7 + c^4 + c^3, 1),
(c^7 + c^4 + c^3 + 1, 1)]
So which coercion should sage or a friend chose for us?
Note: Posting as an Anonymous is possible, but the dialog suffers if there is a follow up...
For instance, which is here the question? How to coerce? Is it enough to work in the bigger field? (Thus defining $a$ as one of the root values above, and $b$ maybe an other one... Who knows?!)