[GAP Forum] Advice on programming an algebra with two fields in
GAP
R.N. Tsai
r_n_tsai at yahoo.com
Wed Jun 29 08:58:15 BST 2005
Dear Stephen and GAP forum :
I don't think this answers your question directly, but a while ago I looked
at similar calculations involving the intersections of planes,lines,points,...
in homogeneous coordinates. I used more of a "tensor based" setting than
your algebra approach. I'm including a small test program that shows some
sample calculations. It may not help much with what you're doing, but here it
is anyway. Good luck.
R.N.
Test:=function()local n,F,G,P1,P2,P3,E1,E2,L1,g,i,p;
n:=4;
F:=Integers;
G:=Elements(SymmetricGroup(n));
#get 3 random points
P1:=List([1..n],x->Random(F));Print("random point #1 = ",P1,"\n");
P2:=List([1..n],x->Random(F));Print("random point #2 = ",P2,"\n");
P3:=List([1..n],x->Random(F));Print("random point #3 = ",P3,"\n");
#calculate plane conatining points P1,P2,P3; e_{ijkl} is levi-civita permutation symbol
Print("plane containing P1,P2,P3 : E1_a = P1^i P2^j P3^k e_{ijka} \n");
E1:=List([1..n],x->Zero(F));
for g in G do
for i in [1..n] do
p:=Permuted([1..n],g);
E1[p[4]]:=E1[p[4]]+P1[p[1]]*P2[p[2]]*P3[p[3]]*SignPerm(g);
od;
od;
Print("E1 = ",E1,"\n");
Print("check P1 in E1 : P1^i E_i = 0 ",Sum([1..n],i->E1[i]*P1[i])=Zero(F),"\n");
Print("check P2 in E1 : P2^i E_i = 0 ",Sum([1..n],i->E1[i]*P2[i])=Zero(F),"\n");
Print("check P3 in E1 : P3^i E_i = 0 ",Sum([1..n],i->E1[i]*P3[i])=Zero(F),"\n");
#calculate line conatining points P1,P2
Print("line containing P1,P2 : L1_{ab} = P1^i P2^j e_{ijab} \n");
L1:=NullMat(n,n,F);
for g in G do
for i in [1..n] do
p:=Permuted([1..n],g);
L1[p[3]][p[4]]:=L1[p[3]][p[4]]+P1[p[1]]*P2[p[2]]*SignPerm(g);
od;
od;
Print("L1 = \n");PrintArray(L1);
#calculate plane conaining line L1 and point P3
Print("plane containing L1,P3 : E2_a = P3^i L1_{ia} \n");
E2:=List([1..n],a->Sum([1..n],i->P3[i]*L1[i][a]));
Print("E2 = ",E2,"\n");
Print("check E1=E2 ",NormedRowVector(E1)=NormedRowVector(E2),"\n");
end;
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Forum
mailing list