[GAP Forum] Coefficients in GAP

李建荣 lijr at lzu.edu.cn
Sun Jan 6 13:52:32 GMT 2013


Dear Forum,

I would like to compute coefficients of a vector in a vector space V with respect to some basis B.
The command in GAP is Coefficients(B, v); 

If B is given by a list, then it seems that it doesn't work. For example, Coefficients([Basis(B)[1], Basis(B)[2], Basis(B)[3], Basis(B)[4], Basis(B)[5], Basis(B)[6], Basis(B)[7], Basis(B)[8], Basis(B)[9], Basis(A)[2]], Basis(B)[4]*Basis(A)[3]) will have errors. Here B is a subspace of the vector space A. A consists of matrices. The codes are in the end of the email. How should I correct  Coefficients([Basis(B)[1], Basis(B)[2], Basis(B)[3], Basis(B)[4], Basis(B)[5], Basis(B)[6], Basis(B)[7], Basis(B)[8], Basis(B)[9], Basis(A)[2]], Basis(B)[4]*Basis(A)[3])? Thank you very much.

With best wishes,
Jianrong.



for i in complement do
for k in [1..9] do
number:=1;
for l in [Basis(B)[1], Basis(B)[2], Basis(B)[3], Basis(B)[4], Basis(B)[5], Basis(B)[6], Basis(B)[7], Basis(B)[8], Basis(B)[9], Basis(A)[i]] do
if Coefficients([Basis(B)[1], Basis(B)[2], Basis(B)[3], Basis(B)[4], Basis(B)[5], Basis(B)[6], Basis(B)[7], Basis(B)[8], Basis(B)[9], Basis(A)[i]], Basis(B)[k]*l)=fail then number:=0; fi;
od;
od;
if number=1 then Add(new_indices_in_LminusOne, i); fi;
od;



More information about the Forum mailing list