the int->integer replacement is done by a preparser. if you turn it
off, sage is "pure" python only.
the list is a pure python object and i don't think it makes sense to
change anything. I recommend you to use a "vector",
sage: vector(RDF, [1,2,3])
h
On Jul 11, 6:41 pm, Carlos Cordoba wrote:
>
You could also make your own sub-class like:
class mylist(list):
def sum(self):
return sum(self)
but then you would have to explicitly cast things to this class.
-M. Hampton
On Jul 11, 11:47 am, Harald Schilly wrote:
> the int->integer replacement is done by a preparser. if you t
Thanks for your quick answers. Coming from Mathematica, I was expecting to
add lists as vectors, multiply real numbers by lists, etc, without
sub-classing or using another types (such as vectors in sage)
Do you advise me to add things to the preparser to have this behaviour or
not? If so, how can
Carlos Córdoba wrote:
> Thanks for your quick answers. Coming from Mathematica, I was expecting to
> add lists as vectors, multiply real numbers by lists, etc, without
> sub-classing or using another types (such as vectors in sage)
>
> Do you advise me to add things to the preparser to have this b
On Jul 12, 9:05 pm, Carlos Córdoba wrote:
> Thanks for your quick answers. Coming from Mathematica, I was expecting to
> add lists as vectors, multiply real numbers by lists, etc, without
> sub-classing or using another types (such as vectors in sage)
just to clarify this, working on lists witho
On Jul 12, 2009, at 2:49 PM, Kevin Horton wrote:
>
> Carlos Córdoba wrote:
>> Thanks for your quick answers. Coming from Mathematica, I was
>> expecting to
>> add lists as vectors, multiply real numbers by lists, etc, without
>> sub-classing or using another types (such as vectors in sage)
Sag
On 13 Jul 2009, at 17:13, Robert Bradshaw wrote:
> In general, we try to avoid modifying the preparser as much as
> possible. Sometimes, we really have to
>
> sage: eval("1/2 + 3^2")
> 1
>
> is really not acceptable (IMHO) for a serious alternative to other
> systems out there
I know what you'r
On Tue, Jul 14, 2009 at 3:01 AM, Paul Sargent wrote:
>
>
> On 13 Jul 2009, at 17:13, Robert Bradshaw wrote:
>
>> In general, we try to avoid modifying the preparser as much as
>> possible. Sometimes, we really have to
>>
>> sage: eval("1/2 + 3^2")
>> 1
>>
>> is really not acceptable (IMHO) for a s
Sorry for not answering before, I've being a bit busy. I'll try to give a
concrete example of what I'm trying to do so you can understand me better.
I have a list of real numbers, for example
[1,2,3]
I want to multiply by 2 to get
[2,4,6]
the to sum it to 3
[5,7,9]
then divide by the max numb
On Jul 14, 1:52 pm, Carlos Córdoba wrote:
> Sorry for not answering before, I've being a bit busy. I'll try to give a
> concrete example of what I'm trying to do so you can understand me better.
> I have a list of real numbers, for example
>
> [1,2,3]
Python "list comprehensions" might be what
Thanks John, I'd seen Python comprehensions before, but since I was trying
to do all in a one-liner, I think I overlooked your elegant and simple
solution. One comprehension at a time is quite neat, but several is just
unreadable.
On Tue, Jul 14, 2009 at 4:28 PM, John H Palmieri wrote:
>
>
>
> On
2009/7/14 Carlos Córdoba :
> Thanks John, I'd seen Python comprehensions before, but since I was trying
> to do all in a one-liner, I think I overlooked your elegant and simple
> solution. One comprehension at a time is quite neat, but several is just
> unreadable.
That could be a function of fam
On Jul 14, 3:35 pm, William Stein wrote:
> 2009/7/14 Carlos Córdoba :
>
> > Thanks John, I'd seen Python comprehensions before, but since I was trying
> > to do all in a one-liner, I think I overlooked your elegant and simple
> > solution. One comprehension at a time is quite neat, but several is
> [ x ] No, I can read the above just fine. It is crystal clear.
... but of course unnecessarily verbose. In my opinion a more common
notation in Sage:
sage: x=2*vector(range(10))+vector(10*[3])
sage: list_plot(map(lambda a:[cos(a),sin(a)],x/max(x)))
is superior to Mathematica.
On Tue, Jul 14
> [ x ] No, I can read the above just fine. It is crystal clear.
... but of course unnecessarily verbose. In my opinion a more common
notation in Sage:
sage: x=2*vector(range(10))+vector(10*[3])
sage: list_plot(map(lambda a:[cos(a),sin(a)],x/max(x)))
is superior to Mathematica.
On Tue, Jul 14
On Jul 14, 2009, at 3:35 PM, William Stein wrote:
> 2009/7/14 Carlos Córdoba :
>> Thanks John, I'd seen Python comprehensions before, but since I
>> was trying
>> to do all in a one-liner, I think I overlooked your elegant and
>> simple
>> solution. One comprehension at a time is quite neat,
> [[cos(a/9), sin(a/9)] for a in [b+3 for b in [2*c for c in [1,2,3
>
> (This is using a/9 instead of a/max(z) since I don't know how to do
> 'max(z)' in a one-liner like this.)
>
Thanks John, when I was talking about unreadable comprehensions I was
meaning this. i.e. nested ones. Then was whe
Carlos Córdoba ha scritto:
>> [[cos(a/9), sin(a/9)] for a in [b+3 for b in [2*c for c in [1,2,3
>>
>> (This is using a/9 instead of a/max(z) since I don't know how to do
>> 'max(z)' in a one-liner like this.)
>>
>>
>
> Thanks John, when I was talking about unreadable comprehensions I was
Laurent, unfortunately that would only work for one particular program or
task. I was hoping to use everywhere the kind of list operations I
mentioned.
Besides, the unreadability problem is still there. You have only transfered
it to the function definition.
On Fri, Jul 17, 2009 at 7:40 AM, Laure
Hi,
Bill Page escribió:
>> [ x ] No, I can read the above just fine. It is crystal clear.
>>
>
> ... but of course unnecessarily verbose. In my opinion a more common
> notation in Sage:
>
> sage: x=2*vector(range(10))+vector(10*[3])
> sage: list_plot(map(lambda a:[cos(a),sin(a)],x/max(x)))
Robert Bradshaw wrote:
> Sage lists are Python lists, which are very different than
> Mathematica lists.
You say that as if it's a fact of geography which can't be changed.
> to change all lists would be a massive (backwards-
> incompatible) change, as well as another step away from Python.
No
On Sun, Aug 2, 2009 at 9:13 AM, Robert Dodier wrote:
>
> Robert Bradshaw wrote:
>
>> Sage lists are Python lists, which are very different than
>> Mathematica lists.
>
> You say that as if it's a fact of geography which can't be changed.
>
>> to change all lists would be a massive (backwards-
>> i
On Sun, Aug 2, 2009 at 2:00 PM, William Stein wrote:
>
> On Sun, Aug 2, 2009 at 9:13 AM, Robert Dodier
> wrote:
> >
> > Robert Bradshaw wrote:
> >
> >> Sage lists are Python lists, which are very different than
> >> Mathematica lists.
> >
> > You say that as if it's a fact of geography which can'
> not supported in pure Python. However, it could add a lot of readability and
> programming easiness to Sage because a common task as a scientist is to
> manipulate and transform a lot of data and (I think) the most basic
> container to do that is a list.
IMHO, an expression like 1 + [2,3,4,5] i
William Stein wrote:
> On Sun, Aug 2, 2009 at 9:13 AM, Robert Dodier wrote:
>> Robert Bradshaw wrote:
>>
>>> Sage lists are Python lists, which are very different than
>>> Mathematica lists.
>> You say that as if it's a fact of geography which can't be changed.
>>
>>> to change all lists would be
25 matches
Mail list logo