Dear all,

I use pylab for plotting, which requires creating lists of x and y
values. Now, in order to manipulate the lists, I would like to perform
simple operations on them, like for example multiply by 2. However,
lists seem to behave very differently to vectors when performing
mathematical operations on them (see below). Is there an easy way of
converting between lists and vectors to use them in mathematical
computations without having to loop through all elements? Intuitively,
I thought that vector(list) would work to convert a list to a vector,
but it does not (see below).

Thanks already for your help, and I'm sorry if I missed this issue in
the documentation.

Stan

----------------------------------------------------------------------
| SAGE Version 3.1.1, Release Date: 2008-08-17                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: v = vector([1,2,3]); v
(1, 2, 3)
sage: 2*v
(2, 4, 6)
sage: w=range(1,4); w
[1, 2, 3]
sage: 2*w
[1, 2, 3, 1, 2, 3]
sage: w1=vector(w)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)

/Users/sschym/modelling/VegPat/<ipython console> in <module>()

/Users/sschym/modelling/VegPat/free_module_element.pyx in
sage.modules.free_module_element.vector (sage/modules/
free_module_element.c:2376)()

/Users/sschym/modelling/VegPat/free_module_element.pyx in
sage.modules.free_module_element.prepare (sage/modules/
free_module_element.c:2622)()

TypeError: unable to find a common ring for all elements

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to