Hi Rob and Javier, Sorry I wasn't clear in my posting. I agree that the way things are done now isn't correct, and what I'm suggesting is to have elementary_divisors return the list of prime powers, and invariant_factors return the m_i's. Rob's suggestion of doing this within the finitely-generated abelian groups class seems sensible.
One caveat is that in 2008 William Stein said that he wanted to be able to create an abelian group with specified generator orders, e.g AbelianGroup([7,8]), which an earlier implementation didn't allow. This is compatible with the above changes, but we should still have a way to get the generator orders. Currently that's "invariants" for AbelianGroups, but the name should probably be changed. Dan On Jun 17, 12:35 pm, javier <vengor...@gmail.com> wrote: > Hi Dan, > > On 17 jun, 17:53, Dan Gordon <dmgo...@gmail.com> wrote: > > > Back in 2008 there was a discussion of the elementary_divisors > > function for abelian groups. While it's not universal, most group > > theory and algebra books define the elementary divisors of a finite > > abelian group G to be a list of prime powers such that G is isomorphic > > to the direct product of cyclic groups of order {p_i}^{n_i}, while the > > invariants are integers m_1,m_2,...,m_k such that m_i | m_{i+1}, and G > > is isomorphic to the direct product of cyclic groups of order m_i. > > For example, right now we have this: > > > sage: G=AbelianGroup([6,10]) > > sage: G.elementary_divisors() > > [2, 30] > > sage: G.invariants() > > [6, 10] > > Maybe I am missing something, but this doesn't look mathematically > correct at all! The factors 2, 30 are not the elementary divisors of > the group, but rather its invariant factors, whilst the elementary > divisors should be 2,2,3,5. It looks to me like in the current > implementation the terms "invariant factor" and "elementary divisor" > are thought of as the same thing, but they shouldnt [1] > > Mathematically, the numbers 6 and 10 are not "invariant" for this > group in any sense as there is no canonical way of picking them just > out of the group structure, so I'd say that the use of the "invariant" > word is not the most appropriate. > > IMO the function "elementary_divisors" should be renamed to > "invariant_factors", and "elementary_divisors" should instead do > something like > > def elementary_divisors(self): > l = [] > for f in G.invariants(): > for p,e in f.factor(): > l.append(p**e) > l.sort() > return l > > As Rob mentions, these algorithms work regardless the structure is > additive or multiplicative (as the only thing needed is the orders of > the direct summands used for defining the group), so they could easily > be refactored inside 9773. > > Cheers > Javier > > [1]http://en.wikipedia.org/wiki/Structure_theorem_for_finitely_generated... -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org