[GAP Forum] Re: Complex numbers (again) and Lie closure
mim_ at op.pl
mim_ at op.pl
Mon Jun 30 08:29:59 BST 2008
Hello Knut,
I am using following function for commuting the set of matrices - see below function commute3. It returns two lists: first is commuted set of matrices, second is list of indexes. List of indexes is useful for using next time to obtain basis of Lie algebra quicker.
My function is quicker than GAP "Basis" function. Here is example of usage:
ms:=[[[0,-1],[1,0]],
[[0,1], [1,0]]];
# Loop execute 3 times, log is printed, if more that 20-dimensional then quit.
aa:=commute3(ms, [], 2, 3, true, 20);
# If you need to commute more then do following
bb:=commute3(aa[1], aa[2], 3, 3, true, 20);
In GAP we could do it like this.
alg:=LieAlgebra(Rationals, ms);
dim:=Dimension(alg);
Print("Dimension of alg is ", dim, "\n");
But sometimes this Dimension function is very slow and sometimes return error. Then you have to do first Basis(alg) and then Dimension(). But Basis() function is also slow.
This is my experience of working with Lie matrix algebras.
Regards,
Marek
# Added more parameteres: a=set of matrices generators,
# ind= set of indexes to show which commutators form basis
# start=index starting from which second base element is commuted - to save time
# times= how many times loop should be executed
# print_log=prints log while commuting
# max_no=quit when length of result basis is longer then max_no
# For now it doesn't work for quaternions !
commute3:=function(a, ind, start, times, print_log, max_no)
local i,j,b,bb,x,count, out_ind, k;
if times=0 then return [a,ind]; fi;
b:=a;
out_ind := ind;
count:=Length(b);
bb:=MutableBasis(CF(4),b);
for i in [1..count-1] do
k:=Maximum(start, i+1);
for j in [k..count] do
x:=b[i]*b[j]-b[j]*b[i];
if not IsContainedInSpan(bb,x) then
Add(b,x); Add(out_ind, [i,j]);
CloseMutableBasis(bb,x); # This should work quicker than MutableBasis(b);
if print_log then Print("[",i,",",j,"]"," added - dim=",Length(b),"\n"); fi;
fi;
if Length(b)>max_no then return [b,out_ind]; fi;
od;
od;
if print_log then Print("Now length of basis b is ",Length(b),"\n"); fi;
if times>1 then
return commute3(b,out_ind, count+1, times-1, print_log, max_no);
fi;
return [b, out_ind];
end;;
More information about the Forum
mailing list