[GAP Forum] op and nops commands?

tkohl at math.bu.edu tkohl at math.bu.edu
Tue Dec 3 15:47:27 GMT 2019



Dear Alexander, 

Thank you very much, this is what I was looking for,
although for some things, I may just funnel the output
through a Perl script to use its regular expression features.

	-T



On Tue, 3 Dec 2019, Hulpke,Alexander wrote:

> Dea Forum,
> 
> Tim Kohl asked
> 
> > On Dec 2, 2019, at 9:17 PM, tkohl at math.bu.edu wrote:
> > 
> > 
> > Dear forum members.
> > 
> > In Maple, there are commands nops() and op() which allow
> > one to 'pick apart' expressions, such as polynomials for example,
> 
> 
> These Maple functions are the interface to Maples internal data type (which is probably a tree structure for algebraic expressions).
> > 
> > i.e. nops(expr) is the number of terms of expr
> >     op(1,expr) is the first term of expr
> > 
> > although how nops() evaluates the number of terms is a bit subtle.
> > 
> > Anyway, I was just wondering if GAP has similar commands?
> 
> GAP has similar commands (the most generic being ExtRepOfObject), though the storage is different and thus interface routines are different.
> > 
> > I am trying to sort (and pull apart) words in fp groups which are,
> > of course, polynomials.
> 
> Probably you want LetterRepAssocWord. Note that the elements of fp groups wrap words in the free group, thus one needs to call UnderlyingElement first:
> 
> gap> f:=FreeGroup("a","b");;
> gap> g:=f/ParseRelators(f,"a2,b3,(ab)5");
> <fp group on the generators [ a, b ]>
> gap> s:=SylowSubgroup(g,2);;
> gap> w:=GeneratorsOfGroup(s)[2];
> b*a*b^-1*a*b*a^-1*b^-1*a^-1*b
> gap> LetterRepAssocWord(UnderlyingElement(w));
> [ 2, 1, -2, 1, 2, -1, -2, -1, 2 ]
> 
> 
> Regards,
> 
>    Alexander Hulpke
> 
> -- Colorado State University, Department of Mathematics,
> Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
> email: hulpke at colostate.edu, Phone: ++1-970-4914288
> http://www.math.colostate.edu/~hulpke
> 
> 
> 




More information about the Forum mailing list