On Nov 16, 2:28 am, Laurent <[email protected]> wrote:
> Assuming you just want to do that a couple of times:
>
> [ a[i]-b[i] for i in range(len(a))  ]

If the indexing bit does not appeal to you, you can also write

[x-y for x,y in zip(a,b)]

If you want a class for with "-" is component-wise, you don't have to
write it. It already exists:

vector(a)-vector(b)

does the trick. If you want to have a list back:

list(vector(a)-vector(b))

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to