To create a fp group you have to define relations on the generators of a free group. To define the generators, you have to have a notation for the group. Why not have the _init_ method of the class define a "(free) base group", "generators (of the free gp)", "relations"? Something roughly (this is off the top of my head and almost certainly wrong) like this:
class FinitelyPresentedGroup_class(group.???): """ ??? """ def __init__(self, n, rels, names="f"): ??? self.__relations = rels self.__base_group = gap.new("Fgp := FreeGroup(%s)"%n) self.__gens = gap.new("GeneratorsOfGroup(Fgp)") def relations(self): return self.__relations def gens(self): ... etc I'm glad someone is working on this. You might want to cc Jack Schmidt ([EMAIL PROTECTED]) on your work. He is not on the sage-devel list and he may or may not have time/interest in helping. But if he has the time, I think he could be very helpful (and he knows GAP, group theory and programming). On 5/28/07, Nathan Dunfield <[EMAIL PROTECTED]> wrote: > > Dear All, > > How does one create new GAP objects that require a multi-step > command? For instance, to create a finitely presented group in GAP > one does: > > gap: F := FreeGroup(2) > <free group on the generators [ f1, f2 ]> > gap: G := F/[F.1*F.2*F.1^-1*F.2^-1] > <fp group of size infinity on the generators [ f1, f2 ]> > > I'm trying to hack up a quick finitely presented group class, and am > trying to write the _gap_init_ method. In simple cases, _gap_init_ > returns a string, but I can't come up with one that works; e.g. the > following fails > > sage: gap.new("F := FreeGroup(2); F/[F.1*F.2*F.1^-1*F.2^-1]") > $sage21:=F := FreeGroup(2); F/[F.1*F.2*F.1^-1*F.2^-1];; > ^ > > executing $sage21:=F := FreeGroup(2); F/[F.1*F.2*F.1^-1*F.2^-1];; > > Now, I could have _gap_init_ return a GAP object created in several > steps, e.g. > > sage: gap.eval("F := FreeGroup(2)") > '<free group on the generators [ f1, f2 ]>' > sage: G = gap.new("F/[F.1*F.2*F.1^-1*F.2^-1]"); > sage: G > <fp group of size infinity on the generators [ f1, f2 ]> > > but this has the disadvantage of littering the GAP interpreter with a > bunch of useless variables (or worse, over-writing something from my > interactive session). > > What's the right solution here? I could assign some awful temporary > variable name in place of F, but there must be a better way... > > Thanks, > > Nathan > > > > > --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---