Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Expressing a list of vectors in terms of basis elements

Let's assume I have a list for my basis [a,b,c,d,e]=BasisList. We can think of a,b,c,d,e as standard basis vectors with a being (1,0,0,0,0) for example.

I also have another list of many vectors each with 5 entries. For example, ExampleList=[(1,2,3,4,5), (2,3,4,1,8),...]. Is there a fast way to express each vector in terms of my basis instead of mulitplying term by term and summing them up. In the example above, I want to end up with the a list

EndList=[a+2b+3c+4d+5e, 2a+3b+4c+d+8e,...] I can of course make a loop and do this summing+multiplying but it gets very long and sometimes redundant if my vector has zeros. I was thinking if there is a way to tell Sage to let a be (1,0,0,0,0), b be (0,1,0,0,0), etc and just do 1 for loop to with command like "for element in ExampleList, express with basis given."

Expressing a list of vectors in terms of basis elements

Let's assume I have a list for my basis [a,b,c,d,e]=BasisList. We can think of a,b,c,d,e as standard basis vectors with a being (1,0,0,0,0) for example.

I also have another list of many vectors each with 5 entries. For example, ExampleList=[(1,2,3,4,5), (2,3,4,1,8),...]. Is there a fast way to express each vector in terms of my basis instead of mulitplying term by term and summing them up. In the example above, I want to end up with the a list

EndList=[a+2b+3c+4d+5e, 2a+3b+4c+d+8e,...] I can of course make a loop and do this summing+multiplying but it gets very long and sometimes redundant if my vector has zeros. I was thinking if there is a way to tell Sage to let a be (1,0,0,0,0), b be (0,1,0,0,0), etc and just do 1 for loop to with command like "for element in ExampleList, express with basis given."