Ask Your Question

Revision history [back]

What sort of objects are the "basis elements"?

sage: var('a b c d e') # symbolic variables
(a, b, c, d, e)

or

sage: R.<a,b,c,d,e> = QQ[] # indeterminate with rational coefficients

In either case:

sage: basis = (a,b,c,d,e)
sage: ExampleList=[(1,2,3,4,5), (2,3,4,1,8), (5,4,3,0,2)]
sage: [sum(x*y for (x,y) in zip(v, basis)) for v in ExampleList]
[a + 2*b + 3*c + 4*d + 5*e, 2*a + 3*b + 4*c + d + 8*e, 5*a + 4*b + 3*c + 2*e]