On 7/22/10 2:36 PM, Maurizio wrote:
I have a quick question that is related to engineering support (I was
reading the document you posted on the wiki about sd24, and I see the
roadmap is planning to address those issues for SAGE 7.0.. ouch!): I
don't know exactly how this is achieved, but I can see that
sage: type(1)
<type 'sage.rings.integer.Integer'>
this should come from the fact that the preparser replaces usual
numbers with sage numerical types.
Nonetheless, still we have:
sage: type([1,2,3])
<type 'list'>
This means that list are not replaced by anything internal, even if
they are collector of python objects which are still sage numbers. I
wonder which is the policy of SAGE towards arrays and matrices. I
think there is a good base in numpy and scipy, so I wonder if it would
make sense to let the preparser transform any list of numbers into a
numpy array. That would greatly improve user ergonomy in case of raw
numbers manipulation.
That could be a not-default option, that could be activated using a
function like:
def numpy_mode(str):
if str == 'on':
from numpy import *
"turn any list into a numpy array"
elif str == 'off':
"reverse behaviour"
[I'm just talking on top of my head]
This will probably require lots of changes in the sage codebase, since I
think there are lots of places that an input is tested to see if it is a
list.
% find . -name \*.py\* | xargs grep isinstance |grep list|wc -l
545
Another slightly related issue is: could we make
plot(numpy.array([1,2,3,4])) behave like
list_plot(numpy_array([1,2,3,4]))? The way it is now, it just doesn't
work...
+1 to plot interpreting numpy arrays. However, shouldn't it interpret
the numpy arrays like it interprets lists? Right now, plot([1,2,3])
works and plots the constant functions 1, 2, and 3.
Thanks,
Jason
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org