The subject says it all really.   Can anyone justify the following behaviour?

sage: A=AbelianGroup([])
sage: A
Trivial Abelian Group
sage: A.list()
[]
sage: list(A)
[]
sage: A.gens()
()

sage: B=AbelianGroup([1])
sage: B
Multiplicative Abelian Group isomorphic to C1
sage: B.list()
[1]
sage: list(B)
[1]
sage: B.gens()
(f,)

When you create an abelian group by giving a list of generators with
their orders, the constructor kills any generators of order 1 UNLESS
you give precisely one generator which has order 1:
sage: AbelianGroup([1])
Multiplicative Abelian Group isomorphic to C1
sage: AbelianGroup([1,1])
Trivial Abelian Group
sage: AbelianGroup([1,1,1])
Trivial Abelian Group

Without going so far aw to completely rewrite AbelianGroups -- which
really does need doing -- I would propose to stop this quiet deletion
of (most) trivial generators.  It can only cause confusion:
sage: AbelianGroup([2,3,2],names='abc').gens()
(a, b, c)
sage: AbelianGroup([2,1,2],names='abc').gens()
(a, b)
In the user's program  -- where the orders of the generators will vary
at run-time this can only cause trouble.

But this is only temporary until someone does a complete rewrite...

John

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to