Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assigning variables in a list

I have a variables list which I use to construct a system of linear equations then I use sage to solve this system. Before I use the solve command I like to equate some of the variables in the list. For example if V is the following list var('x,y,z,w,a,b,c,d') V2=[x,y,z,w,a,b,c,d]

I would like to assignV[i]=V[7-i] for i in [0..3]. When I do this I get invalid syntax error. I know that I could easily set x=d, y=c and so on but this is not feasible when the list has too many items in it. Thank you for your help!