22.7 ExponentSumWord

ExponentSumWord( w, gen )

ExponentSumWord returns the number of times the generator gen appears in the word w minus the number of times its inverse appears in w. If gen and its inverse do no occur in w, 0 is returned. gen may also be the inverse of a generator of course.

    gap> a := AbstractGenerator("a");;
    gap> b := AbstractGenerator("b");;
    gap> w := (a^2*b)^5*b^-1;
    a^2*b*a^2*b*a^2*b*a^2*b*a^2
    gap> ExponentSumWord( w, a );
    10
    gap> ExponentSumWord( w, b );
    4
    gap> ExponentSumWord( (a*b*a^-1)^3, a );
    0
    gap> ExponentSumWord( (a*b*a^-1)^3, b^-1 );
    -3 

Previous Up Top Next
Index

GAP 3.4.4
April 1997