![]() | 1 | initial version |
Here is a slightly convoluted way to work around the current implementation defects.
sage: sage: list(prod((a^b for a, b in zip(H.gens(), h.list())), G.one()) for h in H)
[1, f^2, f^4]
![]() | 2 | No.2 Revision |
Here is The current implementation has some defects
H
have G
as their parentH
Find below a slightly convoluted way to work around
around this.
Define G
and H
:
sage: n = 7
sage: Zn = Zmod(n)
sage: G = Zn.unit_group()
sage: f = G.gen()
sage: H = G.subgroup([f^2])
List the current implementation defects.
sage: sage: elements of H
(this displays using a different f
): sage: Hlist = list(H)
sage: Hlist
[1, f, f^2]
List the elements of H
expressed in G
:
sage: HlistG = list(prod((a^b for a, b in zip(H.gens(), h.list())), G.one()) for h in H)
sage: HlistG
[1, f^2, f^4]
Get their values in Zn
:
sage: HlistZn = [h.value() for h in HlistG]
sage: HlistZn
[1, 2, 4]
3 No.3 Revision
The current implementation has some defects
- elements of
H
have G
as their parent - but they display in terms of a generator of
H
Find below a slightly convoluted way to work around this.
Define G
and H
:
sage: n = 7
sage: Zn = Zmod(n)
sage: G = Zn.unit_group()
sage: f = G.gen()
sage: H = G.subgroup([f^2])
List the elements of H
(this displays using a different f
):
sage: Hlist = list(H)
sage: Hlist
[1, f, f^2]
List the elements of H
expressed in G
:
sage: HlistG = list(prod((a^b for a, b in zip(H.gens(), h.list())), G.one()) for h in H)
sage: HlistG
[1, f^2, f^4]
Get their values in Zn
:
sage: HlistZn = [h.value() for h in HlistG]
sage: HlistZn
[1, 2, 4]
I opened a ticket to make this happen more naturally:
4 No.4 Revision
The current
Going through the group of units
This implementation has some defectssuffers from the defect that
- elements of
H
have G
as their parent - but they display in terms of a generator of
H
Find below Here is a slightly convoluted way to work around this.
Define G
and H
:
sage: n = 7
sage: Zn = Zmod(n)
sage: G = Zn.unit_group()
sage: f = G.gen()
sage: H = G.subgroup([f^2])
List the elements of H
(this displays using a different f
):
sage: Hlist = list(H)
sage: Hlist
[1, f, f^2]
List the elements of H
expressed in G
:
sage: HlistG = list(prod((a^b for a, b in zip(H.gens(), h.list())), G.one()) for h in H)
sage: HlistG
[1, f^2, f^4]
Get their values in Zn
:
sage: HlistZn = [h.value() for h in HlistG]
sage: HlistZn
[1, 2, 4]
I opened a ticket to make this happen more naturally:
Direct access to generating sets for subgroups
The cyclic ring also has a method multiplicative_subgroups
.
That method lists generating tuples for its multiplicative subgroups:
sage: n = 7
sage: Zn = Zmod(n)
sage: Sub = Zn.multiplicative_subgroups()
sage: Sub
((3,), (2,), (6,), ())
Sadly they do not give a hold on the subgroups as such.
sage: H = Sub[1]
sage: H
(2,)
sage: parent(H)
<class 'tuple'>
Neither do the generators for these subgroups have these
subgroups as parents.
Instead, they are simply elements of the initial cyclic ring.
sage: h = H[0]
sage: parent(h)
Ring of integers modulo 7
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.