[sage-devel] Re: [sage-support] converting between lists and vectors?

2008-08-28 Thread Stan Schymanski
That's great, thanks a lot! Stan Martin Albrecht wrote: >> Could you give an example of how to convert a list (e.g. [1,2,3,4]) to a >> vector (e.g. (1,2,3,4) and back again? That would help me a lot. >> > > sage: l = [1,2,3,4] > sage: v = vector(ZZ,l); v > (1, 2, 3, 4) > sage: list(v) # lis

[sage-devel] Re: [sage-support] converting between lists and vectors?

2008-08-28 Thread Martin Albrecht
> Could you give an example of how to convert a list (e.g. [1,2,3,4]) to a > vector (e.g. (1,2,3,4) and back again? That would help me a lot. sage: l = [1,2,3,4] sage: v = vector(ZZ,l); v (1, 2, 3, 4) sage: list(v) # list of ZZs [1, 2, 3, 4] sage: map(int, list(v)) # list of ints [1, 2, 3, 4] Ch

[sage-devel] Re: [sage-support] converting between lists and vectors?

2008-08-28 Thread Stan Schymanski
Hi John, Thanks a lot for your help. John Cremona wrote: > If you want to do mathematical operations such as scalar > multiplcation, convert to a vector. > (You could also do [2*i for i in range(3)], but I don't think you like > that construction.) > Could you give an example of how to conver

[sage-devel] Re: [sage-support] converting between lists and vectors?

2008-08-28 Thread John Cremona
There are two separate things going on here. I think this is a bug: sage: vector(range(3)) TypeError: unable to find a common ring for all elements since this does work: sage: vector(srange(3)) (0, 1, 2) The difference is that the elements of range(3) are python ints while the elements of sran