[GAP Forum] question about translations

Robert F. Morse rm43 at evansville.edu
Tue Apr 24 13:54:02 BST 2007


João Araújo wrote:
> I have a matrix of transformations:
> [[Transformation([1,2]),Transformation([2,2])],
> [Transformation([2,2]),Transformation([2,2])],
> [Transformation([1,2]),Transformation([2,1])]]
> 
> and I want to replace 
> 
> [Transformation([1,2]) by 1;
> [Transformation([2,2]) by 2;
> [Transformation([2,1]) by 3
> 
> obtaining the matrix
> 
> [[1,2],
>  [2,2],
>  [1,3]].
> 

Dear João,

You need a to create some sort of mapping from the transformations to 
the integers. You can do this directly as follows:


gap> d := Domain([ Transformation( [ 1, 2 ] ),Transformation( [ 2, 2 ] ) 
,Transformation( [ 2, 1 ] )]);
<object>
gap> d2 := Domain([1,2,3]);
<object>
gap> tups := List([1..3], i->Tuple([AsList(d)[i],AsList(d2)[i]]));
[ Tuple( [ Transformation( [ 1, 2 ] ), 1 ] ), Tuple( [ Transformation( [ 
2, 2 ] ), 2 ] ),
   Tuple( [ Transformation( [ 2, 1 ] ), 3 ] ) ]
gap> map := GeneralMappingByElements(d,d2,tups);
<general mapping: <object> -> <object> >
gap> IsBijective(map);
true

Then you can just use the map to obtain the matrix entries such as

gap> Image(map,Transformation([1,2]));
1


Another way is to create this map indirectly by putting the 
transformations in a list and asking for their position such as

gap> lst := [ Transformation( [ 1, 2 ] ), Transformation( [ 2, 2 ] ), 
Transformation( [ 2, 1 ] ) ];
[ Transformation( [ 1, 2 ] ), Transformation( [ 2, 2 ] ), 
Transformation( [ 2, 1 ] ) ]
gap> t := Transformation([1,2]);
Transformation( [ 1, 2 ] )
gap> Position(lst,t);
1

Hope this helps.

Robert F. Morse







More information about the Forum mailing list