Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with Abelian groups and trivial elements #2574

Closed
ncalexan mannequin opened this issue Mar 17, 2008 · 6 comments
Closed

problem with Abelian groups and trivial elements #2574

ncalexan mannequin opened this issue Mar 17, 2008 · 6 comments

Comments

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Mar 17, 2008

This is a problem:

sage: AbelianGroup(1, [1], names='e')
Trivial Abelian Group
sage: AbelianGroup(1, [1], names='e').list()
[]

The handling of 1's in the list of element orders is a problem:

sage: AbelianGroup(3, [2, 1, 2], names=list('abc')).list()
---------------------------------------------------------------------------
<type 'exceptions.IndexError'>            Traceback (most recent call last)

/Users/ncalexan/Documents/School/MATH235/genus2cm/<ipython console> in <module>()

/Users/ncalexan/sage-2.10.3.rc3/local/lib/python2.5/site-packages/sage/groups/abelian_gps/abelian_group.py in AbelianGroup(n, invfac, names)
    304     elif len(invfac) > n:
    305         raise ValueError, "invfac (=%s) must have length n (=%s)"%(invfac, n)
--> 306     M = AbelianGroup_class(n, invfac, names)
    307     return M
    308 

/Users/ncalexan/sage-2.10.3.rc3/local/lib/python2.5/site-packages/sage/groups/abelian_gps/abelian_group.py in __init__(self, n, invfac, names)
    371         # *now* define ngens
    372         self.__ngens = len(self.__invariants)
--> 373         self._assign_names(names)
    374 
    375 

/Users/ncalexan/Documents/School/MATH235/genus2cm/parent_gens.pyx in sage.structure.parent_gens.ParentWithGens._assign_names()

/Users/ncalexan/Documents/School/MATH235/genus2cm/parent_gens.pyx in sage.structure.parent_gens.normalize_names()

<type 'exceptions.IndexError'>: the number of names must equal the number of generators

This is the cause of strange things like:

sage: x = ZZ['x'].gen()
sage: K
Number Field in a with defining polynomial x^4 + 4*x^2 + 2
sage: K = NumberField(x^4 + 4*x^2 + 2, 'a')
sage: K.class_group()
Class group of order 1 with structure  of Number Field in a with defining polynomial x^4 + 4*x^2 + 2

CC: @ncalexan

Component: group theory

Keywords: trivial abelian group class group

Issue created by migration from https://trac.sagemath.org/ticket/2574

@ncalexan ncalexan mannequin added this to the sage-2.11 milestone Mar 17, 2008
@ncalexan ncalexan mannequin added c: group theory labels Mar 17, 2008
@ncalexan ncalexan mannequin assigned wdjoyner Mar 17, 2008
@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Mar 17, 2008

comment:1

And also of

sage: x = ZZ['x'].gen()
sage: K
Number Field in a with defining polynomial x^4 + 4*x^2 + 2
sage: K = NumberField(x^4 + 4*x^2 + 2, 'a')
sage: K.class_group()
Class group of order 1 with structure  of Number Field in a with defining polynomial x^4 + 4*x^2 + 2
sage: K.class_group().gens()
[]

@wdjoyner
Copy link

comment:2

I don't know about the class_group code, but this patch fixes the other error mentioned:

sage: AbelianGroup(1, [1], names='e')
Multiplicative Abelian Group isomorphic to C1
sage: AbelianGroup(1, [1], names='e').gens()
(e,)
sage: AbelianGroup(1, [1], names='e').list()
[1]

@wdjoyner
Copy link

abelian group patch

@wdjoyner
Copy link

comment:3

Attachment: 8962.patch.gz

@wdjoyner wdjoyner changed the title problem with Abelian groups and trivial elements problem with Abelian groups and trivial elements [with patch, needs review] Mar 18, 2008
@mwhansen
Copy link
Contributor

comment:4

Looks good to me.

@mwhansen mwhansen changed the title problem with Abelian groups and trivial elements [with patch, needs review] problem with Abelian groups and trivial elements Mar 19, 2008
@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Mar 20, 2008

comment:5

Merged in Sage 2.11.alpha0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants