On 8/14/10 10:46 AM, Maurizio wrote:


On 12 Ago, 09:49, Jason Grout<jason-s...@creativetrax.com>  wrote:
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

What would you expect from such a plot([1,2,3])? Personally,a plot of
a list of points. If the argument of plot is a list of constant
values,can we imagine to change the behavior such to replicate that of
list_plot?



What do you expect from plot(1)? The constant function 1 sounds reasonable. Sage also lets you specify multiple functions using a list, so it follows that plot([1,2,3]) is a plot of the constant functions. I'm not agreeing or disagreeing, but just pointing out the reasoning.

On the other hand, I would definitely expect that points([1,2,3]) should give what you are saying (points (1,1), (2,2), (3,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

Reply via email to